Accidentally Charged Real Money in Stripe
Quick Answer
Live API keys (pk_live_, sk_live_) were used instead of test keys (pk_test_, sk_test_). Start with "Refund immediately" before making broader code changes.
You're in the right place if...
- !Real charges appearing in Stripe
- !Customers complaining about unexpected charges
- !Live transactions in what should be test mode
Why this happens
Live API keys (pk_live_, sk_live_) were used instead of test keys (pk_test_, sk_test_).
Fix
Refund immediately
Stripe Dashboard → Payments → find the charge → click Refund. Refunds process within 5-10 business days.
Switch to test keys
Replace your env vars with test keys immediately:
# Switch ALL env vars to test keys: NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_... STRIPE_SECRET_KEY=sk_test_... # Test keys start with pk_test_ and sk_test_ # Live keys start with pk_live_ and sk_live_
Prevent this next time
ALWAYS verify you're using test keys before running payment flows. Test keys start with pk_test_ and sk_test_.
Frequently Asked Questions
Stripe Dashboard → Payments → find the charge → Refund. Full or partial refunds are available.
Use separate environment variable files for dev (.env.local) and production (Vercel). Never put live keys in .env.local.
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 →