“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:

Stripe API error
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.

Top: a live key asked for a price id that was created in test mode, so Stripe answers No such price. Bottom: test mode and live mode each hold their own copy of the five values, so going live means swapping all five together.

Step 1: find out which mode you are in

Look at the prefix of each key. That is the fastest check:

  • sk_test_ and pk_test_ are test mode.
  • sk_live_ and pk_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.

  1. Secret key. sk_test_ becomes sk_live_. This lives on the server only.
  2. Publishable key. pk_test_ becomes pk_live_. This one is used in the frontend and is safe to expose.
  3. 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.
  4. Webhook endpoint. Create a separate endpoint in live mode that points at your production function address.
  5. 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:

  1. 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.
  2. 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.
  3. 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