Lovable
api
Stripe Test vs Live Mode Confusion
Test payments work but production payments fail. Using test keys in production or live keys in development. Webhooks not firing in right environment. Keys mixed up causing transaction failures.
Stripe has separate test and live environments with different keys. Mixing keys between environments breaks payment flow.
Error Messages You Might See
Invalid API Key provided
Authentication required
Key error: test key used in production
Common Causes
- Using test keys in production API calls
- Using live keys in development (risky!)
- Environment variables not switched between dev/prod
- Test webhook secret used with live key
- Not checking API in right mode in Stripe dashboard
How to Fix It
Use environment-specific keys:
// .env.development
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_...
// .env.production
VITE_STRIPE_PUBLISHABLE_KEY=pk_live_...Always verify mode in Stripe dashboard toggle. Use test cards for development: 4242 4242 4242 4242.
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get Help