fix: separate Stripe test and production price IDs#34
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
STRIPE_SECRET_KEYprefix (sk_test_vssk_live_)PRICE_IDS_LIVE(hardcoded defaults) andPRICE_IDS_TEST(must be configured via env vars)How to configure test mode
Set these env vars in your Firebase Functions config or
.env:Test plan
tsccompiles clean🤖 Generated with Claude Code