UnbreakMyApp / Fix guides

Stripe Checkout fails with "No such price" after you go live

Test payments worked. Live checkout returns No such price (resource_missing). The price id and the API key are from different modes, or the code is sending a product id.

Why it happens

Stripe keeps sandbox (test) objects and live objects apart. A price_ id created while the dashboard was in test mode does not exist for a live secret key, and a live price does not exist for a test key. Stripe's docs put it directly: a test product cannot be part of a live payment. The API error code is resource_missing, and the message is "No such price".

Copy to live mode does not keep the same ids. Stripe copies the product and its prices into new live objects. Later edits to the sandbox product are not applied to copies you already made, so the price_ id still hardcoded in the app is the test one.

Checkout line items need a Price id (price_...), not a Product id (prod_...). AI-built apps also often bake the test price into the frontend and only swap the secret key, or mix pk_test_ with sk_live_. Publishable and secret keys have to be the same mode.

How to fix it, step by step

  1. In the Stripe Dashboard, switch to live mode with the account picker. Open the product and copy the live Price id. Confirm it starts with price_, not prod_.
  2. If the product only exists in the sandbox, open it there and use Copy to live mode, then copy the new live Price id. Do not reuse the test id.
  3. Match the keys to that mode: sk_live_ with pk_live_ in production, sk_test_ with pk_test_ in development. The secret key stays on the server (an Edge Function or API route), never in a VITE_ or NEXT_PUBLIC_ variable.
  4. Put the price id in an environment variable next to the key for that environment, for example STRIPE_PRICE_ID. Redeploy after changing it. Vite and Next.js only pick up new values at build time.
  5. Prefer a lookup_key, which Stripe documents for this. Set the same lookup key (such as plan_monthly) on the test price and the live price. On the server, call prices.list({ lookup_keys: ['plan_monthly'] }) with that environment's secret key, and pass the returned id into the Checkout Session.
  6. Create a Checkout Session in live mode with a real card only after the test-mode session still works. If the session opens and the charge succeeds but the app never upgrades the user, the price is fine and the webhook is the next place to look.

Paste-ready prompt for Lovable

Stripe Checkout fails with "No such price" when we use live keys. Please:
1. Find every place that creates a Checkout Session and every hardcoded price_ or prod_ id.
2. Pass line_items.price from a server environment variable (STRIPE_PRICE_ID), or look it up with stripe.prices.list({ lookup_keys: ['plan_monthly'] }) and use data[0].id. Do not send a prod_ id as a price.
3. Read the secret key only on the server from an environment variable. The publishable key may stay in the client, but it must be the matching mode (pk_test_ with sk_test_, pk_live_ with sk_live_).
4. Tell me which variable names to set for Preview/test and for Production/live, and that I must copy the live price id after "Copy to live mode" because the id changes.
5. Do not unlock the paid feature from the success URL. Leave webhook handling alone unless it is what is broken. Show the diff.

FAQ

I copied the product to live mode. Why is the old id still failing?

Copy to live mode creates a new live product and new live prices. The sandbox price id is a different object. Paste the id from the live product page.

The error says a similar object exists in the other mode. What does that mean?

The id is real, but the key you sent is for the other mode. Use the live price with the live secret key, or the test price with the test secret key.

Still broken?

Get a free diagnosis by email within 24 hours. Fixed or refunded.

Get a free diagnosis

Or get the weekly fix digest:

馃摤 This Week in Broken Apps: the most common Lovable/Supabase breaks and how to fix them. Free, weekly, unsubscribe anytime.

Free: the Vibe-Code Fix Checklist.

Sources