Stripe checkout fails after going live: "No such price"

No such price: 'price_...'; a similar object exists in test mode, but a live mode key was used to make this request. (code: resource_missing). Also seen as "No such customer: 'cus_...'" or with the modes swapped: "a similar object exists in live mode, but a test mode key was used".

Get a written pre-launch auditA human review of this kind of issue, plus the rest of the launch path: three options, from US$39.

What you see

Your Lovable, Bolt or Cursor app took test payments fine with Stripe’s 4242 4242 4242 4242 card. You switch to live keys to start charging real customers, and the Buy button stops working. The server logs, the Supabase Edge Function logs or the Stripe Dashboard’s request logs show:

No such price: 'price_1Abc...'; a similar object exists in test mode,
but a live mode key was used to make this request.
code: resource_missing

The same thing shows up for other objects: No such customer: 'cus_...', No such product, No such payment_intent. Sometimes it’s the other way round: “a similar object exists in live mode, but a test mode key was used”. That one usually means a local or preview build still runs on a test key while the ID it sends is a live one, as in this Stack Overflow question.

Why it happens

Stripe’s API keys page is explicit: 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. So a price_ ID you created while testing simply doesn’t exist for a live key, and Stripe answers with resource_missing, which its error codes page describes as “the resource doesn’t exist, or an ID for a different resource has been provided”.

The “similar object exists in test mode” part is Stripe being helpful: the ID is real, you’re asking for it in the wrong mode.

AI builders wire up test mode first, which is the right way to start, and the test IDs end up in your code, your env vars or your database. Going live is a deliberate swap, and Lovable’s Stripe docs spell it out: switch to a live key, then confirm your products and prices exist in live mode, because price IDs differ between test and live mode.

Fix it

1. Check the mode of every key

Stripe’s key prefixes tell you the mode at a glance:

Key Test (sandbox) Live
Secret key (server only) sk_test_... sk_live_...
Restricted key (server only) rk_test_... rk_live_...
Publishable key (front end) pk_test_... pk_live_...

Check where your app actually reads them: Lovable’s Update Stripe secret key form, Supabase Edge Functions > Secrets, and your host’s environment variables (often VITE_STRIPE_PUBLISHABLE_KEY or NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY). All of them must be in the same mode.

2. Create the products and prices in live mode

You don’t have to rebuild your catalogue by hand. Stripe’s products and prices guide says to set up pricing in a sandbox and click Copy to live mode on the product details page. Each copy creates a new live product with new price IDs, and later changes to the sandbox product don’t carry over, so copy the new price_ IDs from the live product page.

3. Swap the IDs, not just the keys

The most common half-fix is changing the keys and keeping the test price IDs. Search the project for anything that starts with price_, prod_ or cus_:

grep -rn "price_\|prod_\|cus_" src supabase/functions
  • Hard-coded price IDs in a pricing component or an Edge Function: move them into environment variables, one value per environment.
  • Customer IDs saved in your database while testing (a stripe_customer_id column): those customers don’t exist in live mode either. That’s exactly the No such customer case on Stack Overflow. Clear the test IDs, or create a new live customer when the stored one isn’t found.
  • If you’d rather not juggle IDs at all, Stripe’s lookup keys let you fetch a price by a name you choose (for example pro_monthly) instead of hard-coding its ID. Set the same lookup key on the test price and on the live price.

4. Add the live webhook

Stripe’s go-live checklist reminds you that test and live webhook endpoints are separate: if you use webhooks, define live endpoints too. The live endpoint has its own whsec_ signing secret. Keep the test secret on a live endpoint and every event fails with the error in our webhook signature guide, so customers pay but never get access.

5. Rebuild and redeploy

Changing env vars doesn’t change a running app. Vercel’s environment variables docs say changes only apply to new deployments, and front-end variables like VITE_ are copied into the JavaScript at build time (see supabaseUrl is required for the same trap). Redeploy the site and any Edge Functions after you change keys or IDs.

Check it worked

  1. In the Stripe Dashboard, make sure you’re viewing live data and open Workbench request logs. Start a checkout on your published app: the request should succeed with no resource_missing.
  2. Lovable’s docs suggest one real purchase on the published app before you announce the launch. You can refund it from the Dashboard.
  3. Confirm the live webhook shows a 200 delivery and your app unlocked the purchase.

Live-mode payments are one of the places an AI-built app breaks the day it starts making money. Run the free production-readiness checker on your live URL to catch secret keys shipped to the browser and other launch problems in about 20 seconds. If you want a person to go through checkout, webhooks and the rest of your launch path, get a written pre-launch audit.