Stripe checkout works in test mode but fails in live mode. What did I miss?
Run a free check: FlowWatch signs up, logs in and runs a Stripe test checkout on your app, then scans for exposed keys. You get a shareable report. Run the free check at flowwatch.org
You built the app with Lovable, Bolt, Cursor or another AI tool. In test mode the 4242 card goes through and the plan unlocks. You switch to live keys, and the checkout button errors out, the Stripe page never loads, or people pay and stay on the free plan.
The cause is almost always the same: Stripe's test environment and live mode are two separate worlds, and only some of your settings made the move. Stripe's docs put it plainly: each mode has its own set of API keys, and objects in one mode aren't accessible to the other. A sandbox product can't be part of a live payment.
What has to change together
Everything below must come from the same mode. If even one item is still from test mode, live checkout breaks.
| Item | Test looks like | Live looks like | Where it lives |
|---|---|---|---|
| Secret or restricted key | sk_test_… / rk_test_… | sk_live_… / rk_live_… | Server only (Supabase Edge Function secrets, Vercel/Netlify env vars) |
| Publishable key | pk_test_… | pk_live_… | Front end (safe to expose) |
| Price IDs | price_… created in test | a different price_… created in live | Env vars or code |
| Webhook endpoint | test endpoint | a separate live endpoint | Workbench → Webhooks in the newer Dashboard, or Developers → Webhooks in the older layout |
| Webhook signing secret | the test endpoint's whsec_… | the live endpoint's own whsec_… | Server env var |
1. "No such price"
The most common error. It usually reads like this:
No such price: 'price_1Abc...'; a similar object exists in test mode, but a live mode key was used to make this request.That sentence is the diagnosis: the price exists, but in the other mode. Price IDs don't say which mode they belong to, so an AI tool that pasted your test price_… into the code will keep sending it after you swap keys.
Fix: in the Dashboard, open the product in your sandbox and click Copy to live mode (upper right of the product page), or create the product and price again in live mode. The live copy gets a new price ID. Put that ID in your production env vars. Stripe notes that each copy is a separate live product, and later edits to the sandbox product aren't carried over.
If you see No such price: 'prod_…', a product ID was sent where a price ID belongs. Use one of the product's price_… IDs instead.
2. Keys from two different modes
A live publishable key with a test secret key (or the reverse) fails in confusing ways: Stripe.js loads, but the session the server creates belongs to the other mode. Check the actual values on your host, not your local .env:
- The front end should use
pk_live_…. - The server should use
sk_live_…or, better, a restrictedrk_live_…key with only the permissions it needs. - Never put an
sk_key in front-end code. In Vite apps, anything prefixedVITE_ends up in the browser bundle, and in Next.js anything prefixedNEXT_PUBLIC_does too.
Most hosts read env vars when a deployment is built or started. After changing them on Vercel or Netlify, redeploy.
3. The webhook still points at test mode
People pay, Stripe shows the payment, but your app never upgrades them. Webhook endpoints are per mode. The endpoint you set up while testing doesn't receive live events.
Fix: in live mode, open Workbench → Webhooks in the newer Dashboard, or Developers → Webhooks in the older layout, and add a webhook endpoint that points at your production URL (not a preview deploy or localhost), subscribe it to the same events (for example checkout.session.completed and the customer.subscription.* events you handle), then copy that endpoint's signing secret into your production env. Stripe's docs say it directly: webhook secrets are separate from API keys, and each endpoint has its own.
If the live webhook now fails with "No signatures found matching the expected signature for payload", the secret or the raw body is wrong. See our guide on that error.
4. Your code relies on test objects by name
Coupons, promotion codes, tax rates, shipping rates and Payment Links made in the sandbox don't exist in live mode either. Stripe's go-live checklist warns that sandbox objects such as plans, coupons and products aren't usable in live mode. Search your codebase for hard-coded price_, coupon_, promo_, txr_ and plink_ values and buy.stripe.com/test_ links.
A tidier fix for prices: give each price a lookup key (for example pro_monthly) in both modes and look it up at runtime, so the same code finds the right price in each mode.
5. The account can't take live payments yet
If live mode keeps failing even with the right keys and IDs, open the Stripe Dashboard and confirm the account is fully activated for live payments and there are no outstanding requests for business details. Live mode works only once Stripe has what it needs about your business.
6. Test cards don't work in live mode
The 4242 card and other test cards only work with test keys. In live mode they're declined. Also, Stripe's Services Agreement prohibits testing in live mode with real payment method details, so don't make "buy it with my own card" your only test.
A safe go-live pass
- Look at the key prefixes on your production host:
pk_live_in the front end,sk_live_orrk_live_on the server. - In live mode, open each product you sell and copy its
price_…ID into production. Compare it to what's in your env vars. - Open your live checkout and confirm Stripe's hosted page loads with the right product and price. Stop there.
- In live mode, open Workbench → Webhooks in the newer Dashboard, or Developers → Webhooks in the older layout, and confirm a webhook endpoint exists for your production URL with the events you handle, and that its signing secret matches your production env.
- Keep your test setup working for day-to-day testing. A sandbox (or test-mode) checkout with 4242 should still unlock the plan end to end.
- When the first real order comes in, check that the payment in Stripe, the webhook delivery (2xx) and the plan in your database all agree.
Keep it from breaking again
Going live is a one-time switch, but the checkout keeps changing every time you ask your AI tool to "tweak the pricing page". FlowWatch runs signup, login and a Stripe test-mode checkout on your app on a schedule and emails you when a step breaks. For safety it only runs test-mode checkouts and refuses to run if it finds live keys or a non-test checkout. Start with the free check at flowwatch.org.
Sources: Stripe docs, API keys (sandbox vs live mode: separate keys, objects not shared across modes; key prefixes; webhook signing secrets are per endpoint; switch to live mode steps); Stripe docs, Manage products and prices ("Copy to live mode"; each copy is a separate live product); Stripe docs, Go-live checklist (sandbox objects aren't usable in live mode); Stripe docs, Testing (test cards require test keys; the Services Agreement prohibits live-mode testing with real payment method details); Vite and Next.js docs on client-exposed environment variables.
Questions: hello@flowwatch.org