mirror of
https://github.com/AJaySi/ALwrity.git
synced 2026-04-25 17:05:56 +03:00
[PR #374] [MERGED] Load Stripe plan-price mapping from env with startup validation #680
Labels
No labels
AI Content Agents
AI Content Strategy
AI Content planning
AI Marketing Tools
AI SEO
AI personalization
AI writer
ALwrity Copi-lot
Alwrity web search
Anthropic
DeepSeek
Gemini AI
Integration
LLM
OnBoarding
OnBoarding
RAG knowledgebase Memory
bug
documentation
enhancement
good first issue
help wanted
invalid
openai
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ALwrity#680
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/AJaySi/ALwrity/pull/374
Author: @AJaySi
Created: 3/4/2026
Status: ✅ Merged
Merged: 3/5/2026
Merged by: @AJaySi
Base:
main← Head:codex/move-stripe_plan_price_mapping-to-env-driven-config📝 Commits (1)
fc96e12Move Stripe plan price mapping to env with startup validation📊 Changes
4 files changed (+120 additions, -12 deletions)
View changed files
📝
backend/README.md(+20 -0)📝
backend/services/subscription/stripe_service.py(+77 -3)📝
docs/Billing_Subscription/stripe-dev-guide.md(+16 -6)📝
docs/Billing_Subscription/stripe-go-live-checklist.md(+7 -3)📄 Description
Motivation
Description
STRIPE_PLAN_PRICE_MAPPINGwith an environment-driven loader inbackend/services/subscription/stripe_service.pythat: detects mode viaSTRIPE_MODEorSTRIPE_SECRET_KEYprefix, prefersSTRIPE_PLAN_PRICE_MAPPING_LIVE/_TESTand falls back toSTRIPE_PLAN_PRICE_MAPPING, parses JSON, normalizes keys, and builds the runtime mapping and reverse map (STRIPE_PRICE_TO_PLAN).REQUIRED_STRIPE_PLAN_KEYS) to ensure required combinations (currentlybasic.monthlyandpro.monthly) exist and that price IDs are non-empty, raisingRuntimeErroron failure._get_price_id_for_plan,_get_plan_for_price_id) intact but now backed by the validated mapping.docs/Billing_Subscription/stripe-go-live-checklist.md,docs/Billing_Subscription/stripe-dev-guide.md, andbackend/README.mdto document the new env vars and expected JSON mapping format and required keys.Testing
python -m py_compile backend/services/subscription/stripe_service.py(succeeded).STRIPE_PLAN_PRICE_MAPPING_TEST='{"basic":{"monthly":"price_basic"},"pro":{"monthly":"price_pro"}}'and importingSTRIPE_PLAN_PRICE_MAPPING(succeeded and returned expected price id).STRIPE_PLAN_PRICE_MAPPING_TEST='{"basic":{"monthly":"price_basic"}}'and importing the module, which raised the expectedRuntimeErrorfor the missing requiredpro.monthlymapping.Codex Task
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.