Your card was declined / No such price
appears when:After switching to live API keys but real charges still silently fail or never appear in live dashboard
Stripe stuck in test mode in production
Revenue is not reaching Stripe live-mode. pk_test_ still loads in the browser bundle or the live webhook endpoint was never created.
pk_test_ or sk_test_ key is still in the Vercel Production scope and the live-mode webhook endpoint does not exist. Swap every Stripe env var to live-mode values, create the webhook in the live dashboard, recreate products and prices in live mode, and redeploy so the new NEXT_PUBLIC_ key reaches the browser bundle.Quick fix for Stripe stuck in test mode
01# Vercel → Settings → Environment Variables → Production scope02STRIPE_SECRET_KEY=sk_live_...03NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_...04STRIPE_WEBHOOK_SECRET=whsec_live_...05STRIPE_PRICE_PRO=price_live_...06STRIPE_PRICE_ENTERPRISE=price_live_...07 08# Then: Deployments → Redeploy (NEXT_PUBLIC_ values bake at build time)Deeper fixes when the quick fix fails
01 · Grep and rewire hard-coded price IDs
01// ❌ Hard-coded test IDs — break on live key swap02const PRICE_PRO = "price_1OXa8kTest...";03 04// ✅ Read from env so live/test toggle per environment05const PRICE_PRO = process.env.STRIPE_PRICE_PRO!;02 · Inspect the loaded bundle for pk_test_
Open production in incognito, DevTools → Network → filter JS. Search the loaded files for pk_test_. Presence confirms the bundle is stale. Purge the Vercel deployment cache and trigger a redeploy — NEXT_PUBLIC_ values are build-time inlined.
Why AI-built apps hit Stripe stuck in test mode
AI app generators wire up Stripe using the test-mode secret from the first page of Stripe docs. Works immediately — the 4242 4242 4242 4242 test card passes, the webhook fires against the scaffolded route, the UI shows success. Founder ships. Days later a real customer tries to pay and the transaction silently fails with Your card was declined or Checkout never redirects.
Stripe’s test and live modes are essentially two different databases: test customers, products, subscriptions, and webhook endpoints do not exist in live mode and vice versa. A working test integration does not imply a working live integration — every entity must be recreated in live and every env var swapped. AI generators never know this distinction because the conversation was always scoped to test mode.
Vercel compounds the problem by scoping env vars across Production, Preview, and Development. Founders update one scope and assume the others follow. They do not. NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY is further trapped in the built JavaScript bundle — the browser keeps loading the old test key until the app is redeployed.
Stripe stuck in test mode by AI builder
How often each AI builder ships this error and the pattern that produces it.
| Builder | Frequency | Pattern |
|---|---|---|
| Lovable | Every Stripe scaffold | Ships pk_test_/sk_test_ and never creates live webhook |
| Bolt.new | Common | Hard-codes price_test IDs in shared config file |
| v0 | Common | NEXT_PUBLIC_ prefix correct but Production scope missed |
| Cursor | Rare | Leaves test webhook secret in live deploy env |
| Base44 | Common | Creates only a test-mode webhook; live mode never configured |
Related errors we fix
Stop Stripe stuck in test mode recurring in AI-built apps
- →Use different env-var names for live vs test (STRIPE_LIVE_SECRET_KEY / STRIPE_TEST_SECRET_KEY) so mixing is impossible.
- →Add a boot-time check that rejects sk_test_ in NODE_ENV=production.
- →Bundle-analyze the production build and fail CI if pk_test_ appears in output.
- →Keep test keys only in Preview/Development scopes; Production is live exclusively.
- →Make a $1 real-card smoke test part of every production deploy runbook.
Still stuck with Stripe stuck in test mode?
Stripe stuck in test mode questions
How do I know if my Stripe app is still in test mode in production?+
Can I switch from test to live by changing one env var?+
What happens if I accidentally mix test and live keys?+
Why does Vercel keep using my test key even after I updated it?+
Can I test my live integration without charging real money?+
Ship the fix. Keep the fix.
Emergency Triage restores service in 48 hours. Break the Fix Loop rebuilds CI so this error cannot ship again.
Hyder Shah leads Afterbuild Labs, shipping production rescues for apps built in Lovable, Bolt.new, Cursor, Replit, v0, and Base44. our rescue methodology.