Payments fail after launch? Check test vs live Stripe settings
Short answer: Most "payments worked in testing but fail after launch" problems come from a mix of test and live settings: a live publishable key paired with a test secret key, products or prices that only exist in the sandbox, a webhook endpoint registered only in test mode, or a webhook signing secret from the wrong environment. Stripe's keys tell you which is which by their prefix (sk_test_ versus sk_live_), and its go-live checklist covers the rest. Keep each environment's keys, webhook secrets and object IDs together, and run one real low-value transaction before announcing the launch.
How test and live mode differ
Stripe gives every account a separate testing environment (a sandbox, previously called test mode) and live mode. According to Stripe's API keys documentation:
- Sandbox keys start with
pk_test_(publishable),rk_test_(restricted) andsk_test_(secret). - Live keys start with
pk_live_,rk_live_andsk_live_. - Webhook signing secrets are separate from API keys.
Stripe's go-live checklist adds two points that cause most launch-day surprises:
- Objects don't carry over. Products, prices, plans and coupons created in the sandbox aren't usable in live mode. When you recreate them, the checklist advises using the same ID values, not just the same names, so your code keeps working.
- Webhook endpoints are separate. Your account can have both test and live webhook endpoints. If you rely on webhooks, you must define the live endpoint and confirm it behaves exactly like the test one.
The common mix-ups and their symptoms
| Mix-up | What you see |
|---|---|
| Live publishable key with test secret key (or the reverse) | Checkout errors saying an object doesn't exist, or payment details "not found" |
| Price or product ID from the sandbox in live code | "No such price" errors on checkout |
| No live webhook endpoint | Payments succeed at Stripe but orders stay "pending" in your shop or app |
| Test webhook signing secret used in production | Your server rejects every live webhook as having an invalid signature |
| Live keys on a staging site | Real charges from test orders, or real customers emailed from staging |
Organise keys per environment
- Store keys as environment settings, not in code. Production gets live keys; staging and local development get sandbox keys.
- Keep each set together: publishable key, secret or restricted key, and webhook signing secret for the same environment, labelled clearly.
- Add a startup check. Your app can refuse to start in production if a key begins with
sk_test_, or on staging if it begins withsk_live_. That single check prevents the most expensive mistakes. - Prefer restricted keys where your integration allows. Stripe's documentation recommends restricted API keys with only the permissions your integration needs, because full secret keys can't be limited.
- Save live secret keys carefully. Stripe's documentation explains that when you create a live secret key, it's displayed once and can't be revealed again, so store it in your password manager or secret store immediately.
Recreate live objects deliberately
Before launch, list every object your code refers to by ID: products, prices, coupons, tax settings, shipping rates. Then either:
- recreate them in live mode with the same IDs, where Stripe lets you set the ID, or
- keep IDs in configuration per environment rather than hard-coding them.
Plugins and hosted shop platforms often create these objects for you when you connect live mode, so check what your platform does.
Register and test the live webhook
- Create the live webhook endpoint in the Dashboard pointing at your production URL.
- Select the same event types as your test endpoint.
- Copy the live endpoint's signing secret into production configuration.
- After your first live payment, check the endpoint's delivery attempts in the Dashboard: every event should show a successful response from your server.
Do one real transaction
The safest final check is a real purchase with a real card at a small amount, then a refund:
- Place the order on the live site.
- Confirm the payment appears in live mode in the Dashboard.
- Confirm your shop or app marked the order as paid, sent the confirmation email and updated stock.
- Refund it and confirm your system records the refund.
For plugin and hosted-shop users
If you use Stripe through a shop plugin or platform, most of this is a settings toggle: switch the plugin from test to live, paste live keys in the live fields, and let it register webhooks. Stripe's checklist notes that if you're using Stripe through a connected website or plugin, most developer items won't apply. The real transaction test still does.
If a key leaks or a developer leaves
Treat a live secret key like a master password. If it was pasted into a chat, committed to a repository or held by a contractor who has finished, create a new key in the Dashboard, update production, confirm payments still work, then expire the old one. Stripe's keys page describes creating, expiring and rotating keys from the Dashboard. Do the same for webhook signing secrets if they were exposed.
Watch the first week closely
For the first days after launch, check each morning that every paid order in the Dashboard has a matching paid order in your system, and that no webhook deliveries are failing. Small gaps found early are easy to fix; a month of unconfirmed bookings is not.
An illustrative example
A hypothetical Vancouver yoga studio launched online class passes on a custom booking site. Payments went through, but bookings stayed unconfirmed. The developer had added live API keys but never created a live webhook endpoint, and production still held the sandbox signing secret. They created the live endpoint, updated the secret, added a startup check rejecting sk_test_ keys in production, and replayed the missed events from the Dashboard. A real test purchase and refund confirmed the fix.
FAQ
Can a test card be charged in live mode?
No. Test card numbers only work in the sandbox.
Do sandbox customers carry over?
No. Treat live mode as a fresh start for customers and payments.
Should staging ever use live keys?
Avoid it. Use sandbox keys on staging so test orders can't charge real cards.
Where do I see failed webhooks?
In the Dashboard's webhook section for the live endpoint, with each delivery attempt and your server's response.
If your payments work in testing but orders go wrong after launch, tell us how your checkout connects to Stripe.