← All errors · StripeStripe payments & webhook errors

No signatures found matching the expected signature for payload

Exact error

StripeSignatureVerificationError: No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?

What it means

stripe.webhooks.constructEvent() could not verify that the webhook came from Stripe. Verification needs the exact raw body bytes and the matching endpoint signing secret.

Likely causes

How to fix it

  1. In a Next.js App Router route handler, read the raw text body:

    import Stripe from 'stripe';
    const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
    
    export async function POST(req) {
      const body = await req.text();
      const sig = req.headers.get('stripe-signature');
      let event;
      try {
        event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET);
      } catch (err) {
        return new Response(`Webhook Error: ${err.message}`, { status: 400 });
      }
      // handle event.type ...
      return new Response('ok');
    }
  2. In Express, use express.raw for the webhook route only, and register the webhook route before app.use(express.json()). Express runs middleware in order, so a global JSON parser that runs first will break verification:

    // webhook route first, with the raw body
    app.post('/webhook', express.raw({ type: 'application/json' }), handler);
    
    // JSON parser for every other route
    app.use(express.json());
  3. When testing locally with `stripe listen`, use the whsec_ secret the CLI prints, not the dashboard one. For a Dashboard endpoint, open the endpoint in Workbench and click Reveal secret. Print the secret your code actually uses and compare.

  4. Print the stripe-signature header your code receives. It should look like t=...,v1=...; if it is empty, your code is reading the wrong header.

  5. On the Next.js Pages Router, turn off the built-in body parser for the webhook route (export const config = { api: { bodyParser: false } }) and read the raw buffer before calling constructEvent.

  6. If it only fails in one environment (for example staging), that environment almost always has a STRIPE_WEBHOOK_SECRET from a different endpoint, the CLI, or the other mode. Every endpoint has its own whsec_ secret, and a rolled secret stops working once its expiry passes.

Still stuck after trying this? Get it fixed for $49, or you don't pay.

Prevent this next time

FAQ

What does "No signatures found matching the expected signature for payload" mean?

stripe.webhooks.constructEvent() could not verify that the webhook came from Stripe. Verification needs the exact raw body bytes and the matching endpoint signing secret.

What usually causes it?

The body was parsed as JSON (or re-serialized) before verification. Using the wrong signing secret: each endpoint, and the Stripe CLI, has its own whsec_ secret. Test-mode secret used for live-mode events or vice versa.

How do I fix it?

1. In a Next.js App Router route handler, read the raw text body: 2. In Express, use express.raw for the webhook route only, and register the webhook route before app.use(express.json()). Express runs middleware in order, so a global JSON parser that runs first will break verification: 3. When testing locally with `stripe listen`, use the whsec_ secret the CLI prints, not the dashboard one. For a Dashboard endpoint, open the endpoint in Workbench and click Reveal secret. Print the secret your code actually uses and compare. 4. Print the stripe-signature header your code receives. It should look like t=...,v1=...; if it is empty, your code is reading the wrong header. 5. On the Next.js Pages Router, turn off the built-in body parser for the webhook route (export const config = { api: { bodyParser: false } }) and read the raw buffer before calling constructEvent. 6. If it only fails in one environment (for example staging), that environment almost always has a STRIPE_WEBHOOK_SECRET from a different endpoint, the CLI, or the other mode. Every endpoint has its own whsec_ secret, and a rolled secret stops working once its expiry passes.

Last checked against official docs on . Sources: Stripe docs: resolve signature verification errors.

Related errors

More Stripe errors and fixes →

Get new fixes weekly

No spam. Unsubscribe anytime. Privacy