pealdevDOCS
Back to peal.dev

STRIPE STARTER · TEST MODE → LIVE MODE

Test mode → live mode

The day-of-launch checklist. Swap sk_test for sk_live, register the production webhook, update the publishable key. Get it wrong and you'll either charge nothing or charge in test.

Stripe runs two parallel universes: test mode and live mode. Test mode has its own dashboard tab, its own Products and Prices, its own webhook endpoints, its own customers. NONE of it leaks to live. Going live means setting up every piece a second time — for real money.

The key swap

  • STRIPE_SECRET_KEY: sk_test_… → sk_live_… (Dashboard → Developers → API keys, with the live toggle ON)
  • NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: pk_test_… → pk_live_…
  • STRIPE_WEBHOOK_SECRET: whsec_… (different one — see below)

Re-create your Prices in live mode

Test-mode price IDs do NOT exist in live mode. Toggle to live in the dashboard, recreate each Product/Price, copy the new live price IDs, paste them into src/config/pricing.ts (or use env vars if you want to switch via env). Same for the Customer Portal — its config is per-mode too.

Register the production webhook

  • Dashboard → Developers → Webhooks (live mode on) → Add endpoint.
  • URL: https://yourdomain.com/api/webhooks/stripe
  • Select events: checkout.session.completed, invoice.paid, customer.subscription.updated, customer.subscription.deleted (or just the ones your mode uses).
  • Stripe gives you the signing secret. Paste it as STRIPE_WEBHOOK_SECRET in your production env (Vercel, Railway, wherever).

Test cards (use in test mode)

Terminal
4242 4242 4242 4242  Success
4000 0025 0000 3155  Requires 3D Secure
4000 0000 0000 0002  Card declined
4000 0000 0000 9995  Insufficient funds

Don't accidentally ship test keys to prod

Vercel deploy logs sometimes echo the first few chars of env vars. If you see "STRIPE_SECRET_KEY: sk_test..." in your prod deploy summary, stop. You'll either fail at real charges or — worse — charge in test mode where money never actually moves.

Pricing config doesn't switch automatically

The price IDs in src/config/pricing.ts are hard-coded strings. If you only have one set of IDs (test), they'll fail in prod. Either swap them at deploy time or move them behind env vars. We prefer hard-coded + deploy swap because the IDs rarely change.

Run a $0.50 "real" test before launch

Once live keys are deployed, do ONE real purchase with your own card. Confirm the webhook fires, your fulfillment runs, the receipt arrives. Refund yourself. Now you trust it. We've shipped a launch where the prod webhook secret was wrong; nobody noticed for 36 hours.