Stripe Payments Not Working in Lovable App
Quick Answer
Using live Stripe keys instead of test keys, or missing STRIPE_WEBHOOK_SECRET in Vercel environment variables. Start with "Verify test mode" before making broader code changes.
You're in the right place if...
- !Payment form shows but card is declined
- !Checkout redirects to error page
- !Stripe dashboard shows no test payments
Why this happens
Using live Stripe keys instead of test keys, or missing STRIPE_WEBHOOK_SECRET in Vercel environment variables.
Fix
Verify test mode
Stripe Dashboard → toggle 'Test mode' on (top right) → Developers → API keys. Keys should start with pk_test_ and sk_test_. If they start with pk_live_, you're in live mode.
Add all Stripe vars to Vercel
Go to Vercel → Settings → Environment Variables and add:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_... STRIPE_SECRET_KEY=sk_test_... STRIPE_WEBHOOK_SECRET=whsec_...
Test with Stripe's test card
Use this card number for testing:
Card: 4242 4242 4242 4242 Expiry: any future date (e.g. 12/34) CVC: any 3 digits (e.g. 123)
Prevent this next time
Always start with test keys (pk_test_, sk_test_). Only switch to live keys after everything works perfectly in test mode.
Frequently Asked Questions
Test keys start with pk_test_ and sk_test_. Live keys start with pk_live_ and sk_live_. Check in Stripe Dashboard → Developers.
Stripe Dashboard → Developers → Webhooks → your endpoint → Signing secret. Starts with whsec_.
Related fixes
Weekly Newsletter
Get next week's fix before you need it.
Join developers getting weekly vibe coding tips, error fixes, and tool updates.
Subscribe on Substack →