Stripe webhook: No signatures found matching the expected signature
Published
The error
StripeSignatureVerificationError: No signatures found matching the expected signature for payload
Why it happens
constructEvent needs the raw request body exactly as Stripe sent it. Frameworks that parse JSON first (Express json(), Next.js req.json()) change the body, so the signature fails. A wrong webhook secret (CLI secret vs dashboard secret, test vs live) causes the same error.
How to fix it
- Read the raw body: in Next.js App Router use await req.text(); in Express use express.raw({type: 'application/json'}) on that route only.
- Use the whsec_ secret for this exact endpoint and mode (stripe listen prints a different one).
- Pass the stripe-signature header unchanged.
- Return 200 quickly and do slow work afterwards.
Fix prompt (paste into Lovable, Bolt, Cursor, Replit or v0)
My Stripe webhook fails with 'No signatures found matching the expected signature'. Rewrite the webhook route to verify using the raw request body (req.text() in Next.js App Router or express.raw for that route), read STRIPE_WEBHOOK_SECRET from server env, return 400 on bad signatures and 200 after handling checkout.session.completed. Don't parse JSON before verification.
Error codes this fixes
StripeSignatureVerificationError(Stripe)
FAQ
Which secret do I use locally?
The whsec_ printed by stripe listen. In production use the endpoint's secret from the Dashboard.
Test vs live?
Each mode and each endpoint has its own signing secret.
Sources
Based on the official documentation:
Related fixes
- Stripe webhook returns 401 from a Supabase Edge Function (Missing authorization header / Invalid JWT)
- Stripe email: Your webhook endpoint is failing and will be disabled. How to fix and re-enable it
- Supabase: Edge Function returned a non-2xx status code (how to find the real error and fix it)
- App works on localhost but breaks in production: a checklist to find the cause
Want the full checklist for this area? Get a Fix Kit ($29)
Featured slot available: reach thousands of vibe coders. Sponsor this week →
Get one new fix a week
Free newsletter: the newest breakages in Lovable, Bolt, Cursor, Replit and v0 apps, with paste-in fixes.
We only use your email to send the newsletter. Unsubscribe any time. See privacy.