“No such price” when going live: Stripe test and live mode mixed up
Updated · by Zane
What the error looks like
You built the payment flow in test mode and it worked. Then you switched to live keys and checkout broke with this message from Stripe:
No such price: 'price_...'Often it comes with an extra sentence saying a similar object exists in test mode, but a live mode key was used to make this request. The reverse also happens, with the words live mode and test mode swapped. That sentence is the whole diagnosis. The price is real. You are asking for it in the wrong mode.
Why test and live do not share anything
Stripe keeps test mode and live mode completely apart. Products, prices, customers, webhook endpoints and signing secrets each exist twice, once per mode, and the ids are different. A price_ id you created while testing means nothing to a live key.
An AI builder usually wires up test mode first, because that is the safe way to start. So the test ids end up pasted into your code or settings. Going live then needs a deliberate swap. Nothing swaps for you.
Step 1: find out which mode you are in
Look at the prefix of each key. That is the fastest check:
sk_test_andpk_test_are test mode.sk_live_andpk_live_are live mode.
The Stripe Dashboard has a test mode switch too. Flip it and you will see a different, separate set of products and customers. If your price is on one side and your key is for the other, you have found the problem.
The five things that must change together
Go through this list. All five must belong to the same mode.
- Secret key.
sk_test_becomessk_live_. This lives on the server only. - Publishable key.
pk_test_becomespk_live_. This one is used in the frontend and is safe to expose. - Price ids. Create the product and price again in live mode, or use Copy to live mode on the product page in Stripe. Then put the new
price_ids into your app. - Webhook endpoint. Create a separate endpoint in live mode that points at your production function address.
- Webhook signing secret. The live endpoint has its own
whsec_value. Use that one, not the test endpoint's.
The usual ways people mix them
- Frontend has the live publishable key, but the backend still has the test secret key. Checkout opens, then the session fails.
- Both keys were swapped, but the price id is still the test one. This is the error at the top of the page.
- Keys and prices are live, but nobody created a live webhook endpoint. Money arrives and the user is never upgraded. That is the situation in Stripe payment succeeded but the user is still on the Free plan.
- The live endpoint exists, but its secret in your app is still the test one. Every delivery then fails verification, which is covered in Stripe webhook signature verification failed.
Step 2: change the values where they actually live
There are two places, and each needs a different follow-up.
Frontend variables
The publishable key and any price ids the page uses sit in your hosting platform's build variables. These are baked in when the app is built, so changing them does nothing until you rebuild and publish again. The same trap causes blank pages after publishing, which I describe in Blank white page after publishing your AI-built app.
Server function variables
The secret key and the webhook secret sit in your function's environment. In Supabase that is Edge Functions, then Secrets. After changing them, redeploy the function. I would not trust a value until I had redeployed.
Step 3: check without spending real money
Do not use your own card on a live price and refund yourself as a routine check. Instead:
- Make the whole flow pass in test mode first, with Stripe's test card. Payment, webhook delivery with a 200 response, and the plan change should all work.
- Switch to live mode and only read. Check the key prefixes. Open the live product page and confirm each price id is there. Open Developers, then Webhooks, and confirm the live endpoint exists and is subscribed to the events your function handles.
- When the first real customer payment happens, open the live endpoint in Stripe straight away and confirm the delivery got a 200.
A live account that has not finished Stripe's business details step cannot take real payments yet. If everything above is right and charges still fail, finish that setup in Stripe.
Where the demo fits
I walk through a payment flow and its failure points in the demo videos on the home page. The same rule holds there: one mode at a time, and the webhook has to match the mode of the payment.
FAQ
Can I use my test products in live mode?
No. Test mode and live mode are separate sets of data. A product and price made in test mode do not exist in live mode, so you create them again there. Stripe's product page also has a Copy to live mode option, which saves retyping. Either way, put the new price_ ids into your app.
Do I need a second webhook?
Yes. Each mode has its own endpoints and its own signing secrets. Create an endpoint in live mode that points at your production function, subscribe it to the events you need, and use its own whsec_ secret. Without it, customers pay and nothing upgrades.
Why does checkout open but then fail?
The usual cause is a mix of modes. The publishable key on the page can be live while the server key that creates the session is still a test key, or the price id belongs to the other mode. Check all five values in the list above, not just one.
Checklist
Still stuck?
Send me the app link and what's broken. The first look is free and you get a fixed quote before I touch anything.
Related guides
- Bolt.new Stripe webhook not working after deploying to Netlify (404 or no upgrade)
- Lovable custom domain with Cloudflare: fix "too many redirects" (ERR_TOO_MANY_REDIRECTS)
- Lovable custom domain not working: stuck pending, no SSL, or www fails
- Lovable email verification not working: signup confirmation emails not arriving
- Lovable Google sign in showing redirect_uri_mismatch or an unverified app warning
- Base44 custom domain stuck on Pending verification
- Base44 payment succeeded, but the customer was not upgraded
- Lovable Stripe checkout: "Edge Function returned a non-2xx status code"
- Lovable password reset link not working or sending users to the wrong page
- Replit custom domain not working: stuck on Verifying or showing a blank page
- Is your Supabase data public? A two-minute RLS check
- Blank white page after publishing your AI-built app
- Stripe payment succeeded but the user is still on the Free plan
- Subscription cancelled in Stripe but the user still has the paid plan
- Stripe webhook signature verification failed (400): causes and fix
- Login sends users to localhost or the preview URL after publishing
- Supabase update returns no error but nothing changes