Skip to content

fix: separate Stripe test and production price IDs#34

Merged
nick-transition merged 6 commits into
mainfrom
fix/stripe-test-prod-separation
Apr 20, 2026
Merged

fix: separate Stripe test and production price IDs#34
nick-transition merged 6 commits into
mainfrom
fix/stripe-test-prod-separation

Conversation

@nick-transition
Copy link
Copy Markdown
Owner

Summary

  • Detect test vs live mode automatically from the STRIPE_SECRET_KEY prefix (sk_test_ vs sk_live_)
  • Separate price ID config: PRICE_IDS_LIVE (hardcoded defaults) and PRICE_IDS_TEST (must be configured via env vars)
  • Fail fast with a clear error message if test mode price IDs aren't set
  • No changes needed for production — existing price IDs are preserved as live defaults

How to configure test mode

Set these env vars in your Firebase Functions config or .env:

STRIPE_PRO_PRICE_ID_TEST=price_xxx
STRIPE_COACH_PRICE_ID_TEST=price_yyy

Test plan

  • tsc compiles clean
  • CI build passes

🤖 Generated with Claude Code

Nick Stoddart and others added 6 commits April 12, 2026 20:29
Detect test vs live mode from the STRIPE_SECRET_KEY prefix (sk_test_
vs sk_live_). Use separate price ID sets so test mode doesn't hit
production price objects. Test price IDs default to null and must be
configured via STRIPE_PRO_PRICE_ID_TEST / STRIPE_COACH_PRICE_ID_TEST
env vars — checkout will fail fast with a clear error if missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Existing hardcoded price IDs were test mode — move them to PRICE_IDS_TEST.
Create live products and prices via Stripe CLI and set as PRICE_IDS_LIVE
defaults. Deploy live STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET to
Firebase Secrets, and create live webhook endpoint.

Live prices:
  Pro:   price_1TLYZ2Q3zUu0EIKvJYP1vuei ($9.99/mo)
  Coach: price_1TLYZYQ3zUu0EIKvS79urawK ($29.99/mo)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hardcoded price IDs were a foot-gun: test-mode IDs as live defaults
would silently fail at checkout, and the previously-baked live IDs
belonged to an unverified Stripe account. Require explicit
configuration in both modes so missing config fails fast with the
existing descriptive error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Provides the verified test-mode price IDs ($9.99 pro, $29.99 coach) so
contributors can `cp .env.example .env` and run against the FitApp
sandbox without digging through the Stripe dashboard. Live price IDs
are left blank — they must be created in the live Stripe account and
set explicitly before a live-mode deploy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Firebase Functions v2 auto-loads .env.<projectId> at deploy time, so
there's no manual step to propagate config to prod. Price IDs aren't
secrets (they're client-visible in Stripe checkout URLs), so they
belong in version control alongside the code that consumes them.

Replaces the less-useful .env.example. Live IDs are intentionally
blank — fill them in once live Stripe prices exist; until then, a
live-mode deploy fails fast on checkout with the env var name to set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Both $9.99 pro and $29.99 coach prices verified against live mode
Stripe account acct_1TKU0BQ3zUu0EIKv via the Stripe CLI. These are
the only two live prices on the account, so there's no ambiguity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@nick-transition nick-transition enabled auto-merge (squash) April 20, 2026 01:56
@nick-transition nick-transition merged commit d7772de into main Apr 20, 2026
2 checks passed
@nick-transition nick-transition deleted the fix/stripe-test-prod-separation branch April 20, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant