No such price
Stripe couldn’t find the price ID your code sent, because it belongs to the other mode, another account or sandbox, or isn’t a price ID at all.
Also appears as
- StripeInvalidRequestError: No such price: 'price_1Q2w3E4r5T6y7U8i9O0pAbCd'; a similar object exists in live mode, but a test mode key was used to make this request.
Prompt to fix it
Creating a Stripe Checkout session fails with "No such price: 'price_...'". Find every place the code references a Stripe price or product ID. Check whether the IDs match the mode of the secret key we use (test or live) and whether any are product IDs (prod_) used as prices. Move price IDs into environment variables, or use Stripe lookup keys, so test and live each use their own. Tell me which prices I need to create or copy in the Stripe Dashboard. Don’t switch the live site to test keys to make it work.
Paste into Layerwise or any AI coding tool.
What it means
A price in Stripe is the amount and billing interval attached to a product, and its ID starts with price_. This error means Stripe found no price with that ID in the account and mode your API key belongs to. Stripe tags it with the error code resource_missing.
Test mode, live mode, and each sandbox keep separate copies of everything. A price created in test mode doesn’t exist in live mode, so code with a hardcoded test price ID breaks the moment you switch to live keys. When that’s the whole story, Stripe adds “a similar object exists in live mode, but a test mode key was used” to the message, or the reverse.
Keep price IDs out of your code. Store them in environment variables for each environment, or look prices up by a lookup key you set in the Dashboard, so the same code works with test and live keys.
Common causes
- The code uses a test-mode price ID with a live key, or a live price ID with a test key.
- The price was created in a different Stripe account or sandbox from the one the API key belongs to.
- The code passes a product ID (
prod_...) where a price ID belongs. - The price ID is a placeholder an AI tool made up, or it was copied with a typo.
How to fix it
- Check which key your server uses (
sk_test_orsk_live_) and which account or sandbox it belongs to. - In the Stripe Dashboard, switch to that same mode or sandbox, open the product catalog, open the product, and copy its price ID.
- If the product exists only in test mode, create it in live mode too, or use Copy to live mode on the product page.
- Move price IDs into environment variables, such as
STRIPE_PRICE_PRO, with test values for development and live values for production. - Or give each price a lookup key and fetch it with
stripe.prices.list({ lookup_keys: ['pro_monthly'] }).
Example fix
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
// Give the price the same lookup key in test and live mode,
// so this code works with either key.
const { data } = await stripe.prices.list({ lookup_keys: ['pro_monthly'] });
const price = data[0];
if (!price) throw new Error('No price with lookup key pro_monthly in this mode');
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{ price: price.id, quantity: 1 }],
success_url: 'https://my-app.com/success',
cancel_url: 'https://my-app.com/pricing'
});Related errors
All errorsInvalid API Key provided
Stripe rejected the request because the API key it received doesn’t match any active key, often a placeholder, a typo, or a deleted key.
No signatures found matching the expected signature
Your webhook code couldn’t verify that a Stripe event is genuine, usually because the body was parsed before the check or the secret is wrong.
Build with an agent that checks its work
The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.