Error library

Stripe webhook signature verification failed: fix

Stripe raises this when one of the three inputs to constructEvent() is wrong: the raw request body, the Stripe-Signature header, or the endpoint secret. Pass the unmodified raw body (not parsed JSON) and the whsec_ secret for that exact endpoint.

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

Cause: Wrong endpoint secret (often CLI vs Dashboard secret mixed up) or a framework parsed/re-serialized the body before verification.

How to fix it

  1. Confirm the whsec_ secret matches the endpoint receiving events (Dashboard endpoint secret vs stripe listen secret are different).
  2. Pass the raw body: express.raw({type: 'application/json'}) in Express, or await req.text() in Next.js route handlers.
  3. Read the Stripe-Signature header; it should look like t=...,v1=....
  4. Use separate secrets for test and live mode endpoints, and redeploy after changing env vars.

Example

Illustrative example, not from a customer project.

- app.post('/webhook', express.json(), (req, res) => {
+ app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
    const sig = req.headers['stripe-signature'];
    const event = stripe.webhooks.constructEvent(req.body, sig, process.env.STRIPE_WEBHOOK_SECRET);

FAQ

It works with the Stripe CLI but fails in production. Why?

The CLI prints its own whsec_ secret. Production needs the secret of the Dashboard endpoint.

Can I just skip verification?

You shouldn't. Verification is how you know the event came from Stripe.

QUICK FIX · $49 · THIS ERROR ONLY

Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis

One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.

Bigger job: Whole Stripe setup not live? Stripe go-live, $400–800 fixed.

Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.

Check it yourself first, free

$49Fix this error