7 min read
Stripe webhook works in test mode but not live
Customers pay, Stripe says the payment succeeded, and your app does nothing: no access, no receipt, no record. It worked perfectly in test mode. This is one of the most common launch-day problems, and it's nearly always one of these.
1. There's no webhook in live mode
Test mode and live mode have separate webhook endpoints. While building, events often reached your app through the Stripe CLI (stripe listen), which only forwards test events to your computer. In live mode, nothing is listening until you add an endpoint.
Switch the Stripe dashboard to live mode, open Developers, then Webhooks, and check there's an endpoint with your production address and the events your code handles (often checkout.session.completed, invoice.paid and customer.subscription.updated and deleted).
2. The signing secret is the test one
Each endpoint has its own signing secret (it starts with whsec_). If production still has the test endpoint's secret, or the CLI's, every live event fails the signature check. Copy the live endpoint's secret into your production environment variables and redeploy.
3. The body is changed before the signature check
Stripe signs the exact bytes it sends. If your framework parses the JSON first, the signature no longer matches. Read the raw body: await request.text() in a Next.js route handler, express.raw({ type: 'application/json' }) on that route in Express.
4. The address redirects, needs a login, or is slow
- Stripe doesn't follow redirects. If
example.comredirects towww.example.com, or http to https, use the final address. - Sign-in middleware must skip the webhook route: Stripe can't log in.
- Reply 200 within a few seconds and do slow work (emails, provisioning) afterwards, or Stripe times out and retries.
5. Fix it and recover the missed payments
In the endpoint's page in live mode, each failed delivery shows the response your app gave. Fix the cause, then resend the failed events from there, and check those customers got what they paid for.
Prompt for your AI tool
My Stripe webhook works in test mode but fails in live mode. Check my webhook route: it must read the raw request body, verify the Stripe-Signature header with constructEvent and the LIVE signing secret from an environment variable, skip any auth middleware, and return 200 quickly before slow work. List the events it handles so I can match them in the Stripe dashboard.
Hear about it before your customers do
Payments health checks your live Stripe webhooks every day with a read-only key: no live webhook, one Stripe has switched off, events Stripe couldn't deliver, and whether your webhook refuses a fake, unsigned event.
Who gets it: Pro, Agency and Vern Care
See plans