Question

Switched Stripe to live keys and checkout now says "No such price"

Solved · 724 viewsasked by priya_ships

Launch day, of course. Test mode worked perfectly for weeks. I swapped STRIPE_SECRET_KEY to the sk_live_ key and now clicking Subscribe gives this in the browser console:

I did create the same product in live mode. Why is it still looking for the test one?

What I’ve tried

Recreated the product in live mode by hand, cleared browser cache, checked the secret key is really sk_live.

Comment
Search your code for price_1 - bet it's hardcoded somewhere. hannah_reyes
searching now priya_ships

3 answers

Marked as helpful by the asker
tobiasw

The error says it: test and live are two completely separate worlds. Your new live product got a new price ID. The old price_1Q8xYzL... is hardcoded somewhere (Lovable tends to put it straight in the component or in a const PRICES = {...} file).

Fix:

  1. Dashboard, toggle to live, open the product, copy the live price ID.
  2. Put price IDs in env vars (STRIPE_PRICE_PRO_MONTHLY) instead of code, so test and live each get their own.
  3. While you're at it, check the other Stripe things that are per-mode: webhook endpoint + its signing secret, customer portal settings, tax settings, coupons.

Tip for next time: products have a "Copy to live mode" action, which saves recreating them, but you still get new IDs.

Comment
Found it in src/lib/plans.ts. Live now, first real payment came in 20 min later. Thanks a lot priya_ships
bytebarista

Also if you store stripe_customer_id in your DB from testing, those test customers don't exist in live either. Wipe them or you'll get No such customer next.

Comment
yep that happened 10 min later, thanks for the warning priya_ships
diego_mx

And the publishable key on the frontend (pk_live_...) has to match the mode too. Mixed keys give confusing errors in Stripe.js before you even reach checkout.

Comment