Skip to content
>_VibeUnstuck

No such price: wrong Stripe mode

Last verified:

The fix

No such price: that price_ id is from the other Stripe mode, or the code sent a product id. Copy a price from the same mode as the secret key.

  1. 1

    Match the key to the mode

    Test secret keys start with sk_test_. Live keys start with sk_live_. In the Dashboard, the Test mode toggle has to match the key the server is using. Preview deployments should use test keys and test prices.

  2. 2

    Pass a price ID

    Checkout line_items[].price must be price_.... If you only have a product, open the product and copy the price ID under it. One product can have several prices. Pick the one you charge.

  3. 3

    Store the ID in env, per environment

    Put the test price in the preview env and the live price in production. Do not hardcode a price the model copied from a screenshot of someone else’s dashboard.

  4. 4

    Confirm the ID still exists

    A deleted or archived price returns the same error. Recreate it or unarchive it in the same mode, then update the env var and redeploy.

Why it happens

Price IDs are not shared between test mode and live mode. A price_ copied while the Dashboard toggle said “Test mode” does not exist for an sk_live_ key, and the reverse is also true. Stripe answers No such price.

A product ID (prod_) is not a price. Checkout line items need price. A restricted key that cannot read prices fails differently. This error means Stripe looked up that ID in the mode of the secret key and did not find it.

The next error you'll probably hit

Once this is fixed, the usual follow-up is Stripe webhook not firing. Stripe webhook not firing: Checkout can succeed while your server never gets the event. Point the endpoint at the deployed URL and return 200.

Prompt to paste back into your AI tool

Paste this above the error.

Stripe returns: No such price: 'price_...'.

Do not catch this and show a generic success. Do not switch the secret key to live to make a test price work.

1. Check whether the server key is sk_test_ or sk_live_, and whether this price was created in that same mode.
2. If the ID starts with prod_, replace it with the price_ on that product.
3. Read the price ID from an env var so preview and production can differ.
4. Change only the Checkout session creation.

Common questions

+The price is visible in the Dashboard and the API says it does not exist. Why?

The Dashboard is in the other mode, or you are looking at a different account than the secret key. Toggle Test mode and compare the price ID character for character.

+Can I use a product ID in line_items?

Not in the price field. Use the price ID. If you use price_data to define an ad-hoc price, you pass the product ID there, which is a different shape. Do not mix them.

Related errors