Skip to content

Add env-controlled strict Stripe checkout guard#450

Merged
AJaySi merged 1 commit into
mainfrom
codex/add-env-controlled-guard-for-stripe-key
Apr 3, 2026
Merged

Add env-controlled strict Stripe checkout guard#450
AJaySi merged 1 commit into
mainfrom
codex/add-env-controlled-guard-for-stripe-key

Conversation

@AJaySi
Copy link
Copy Markdown
Owner

@AJaySi AJaySi commented Mar 30, 2026

Motivation

  • Make Stripe integration opt-in-strict for demos or production so missing Stripe keys fail loudly when required.
  • Preserve the current fallback behavior in environments that do not opt into strict mode.

Description

  • Add _is_truthy_env helper and wire REQUIRE_STRIPE_CHECKOUT into StripeService to enable strict backend mode.
  • When REQUIRE_STRIPE_CHECKOUT=true and STRIPE_SECRET_KEY is missing, StripeService now raises a clear HTTPException(500) instead of allowing silent fallback.
  • Add frontend handling via REACT_APP_REQUIRE_STRIPE_CHECKOUT and REACT_APP_STRIPE_PUBLISHABLE_KEY checks in PricingPage to force the Stripe checkout path and throw errors when the publishable key is missing or checkout URL is not returned.
  • Surface strict-mode error messages in the UI by propagating the actual error string to the page error banner.

Testing

  • Ran python -m compileall backend/services/subscription/stripe_service.py which succeeded.

Codex Task

@AJaySi AJaySi merged commit e64aea4 into main Apr 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant