stripe no such price even though the price id is correct: livemode vs testmode key mixup
Diagnoses Stripe's 'No such price' error when the price id is correct but lives in the other mode. Shows an agent how to compare the key's mode prefix against the dashboard mode and either switch keys or recreate the price. Use when the error appears only in production or only in development. Do not use for archived prices or id typos without checking both modes first.
stripe no such price even though the price id is correct: livemode vs testmode key mixup
TL;DR: the price id is correct, but it lives in the other mode. Stripe objects are mode-scoped: a test price is invisible to a live key and vice versa. Check whether your key starts with pklive or pktest, match it to the mode where the price exists, and either switch keys or recreate the price in the right mode.
stripe no such price even though the price id is correct: livemode vs testmode key mixup- Print the first few characters of the key your code is actually using (never log the whole key). Expected: you see pklive or pktest, or rklive / rktest for restricted keys.
- In the dashboard, toggle between test and live mode and search the price id in each. Expected: the price appears in exactly one mode.
- If the modes differ, switch your environment to the matching key. Expected: the same API call now succeeds.
- If you need the price in the other mode, recreate it there; ids will differ, so update your config. Expected: both modes have their own price id.
- Add a startup check that asserts key mode matches the expected environment. Expected: the next mixup fails fast with your own clear error.
When this applies:
- No such price with an id you copied from the dashboard
- Works locally, fails in production (or the reverse)
When it doesn't:
- The price was archived or deleted (check both modes first anyway)
- Webhook endpoints hitting the wrong mode (fix the endpoint config, same root cause)
Compatibility: Stripe API 2025-XX; dashboard test/live toggle; any SDK.
Stripe No such price with correct id
Check the mode before anything else; it is the cause nine times out of ten.
price id works in test but not live
Recreate the price in live mode and update your production config with the new id.
No such price error after deploying to production
The deploy likely shipped a test key or a test-mode price id; verify both.
Why it happens: Stripe keeps two completely separate datasets behind one dashboard toggle. Copying an id from test mode while the server runs a live key is the classic version of this bug, and the error message does not hint at modes.
Edge cases: restricted keys also carry a mode, so rotating keys can silently flip you. Webhook signing values are mode-specific too; a mode mixup usually breaks webhooks next. Prices cannot be copied between modes, only recreated.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstMSGD4lZ981XXDXsg99bGg