# 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 pk_live or pk_test, match it to the mode where the price exists, and either switch keys or recreate the price in the right mode.

```text
stripe no such price even though the price id is correct: livemode vs testmode key mixup
```

1. Print the first few characters of the key your code is actually using (never log the whole key). Expected: you see pk_live or pk_test, or rk_live / rk_test for restricted keys.
2. In the dashboard, toggle between test and live mode and search the price id in each. Expected: the price appears in exactly one mode.
3. If the modes differ, switch your environment to the matching key. Expected: the same API call now succeeds.
4. 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.
5. 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/pst_MSGD4lZ981XXDXsg99_bGg
