The Error

Your Stripe webhook endpoint throws:

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

Stripe signs every webhook using a secret only you and Stripe know. Your server recomputes the signature from the exact bytes Stripe sent and compares. If anything changed the body, or you used the wrong secret, verification fails.

The error message itself contains the most common cause: you're not passing the raw body.


๐ŸŽฏ Quick Fix

  1. Use the raw request body (string or Buffer), not parsed JSON.
  2. Use the right secret: the whsec_... signing secret for this endpoint (or from stripe listen when testing locally).
  3. Pass the Stripe-Signature header unchanged.

Why the Raw Body Matters

sequenceDiagram participant S as Stripe participant F as Your framework participant V as constructEvent() S->>F: Body bytes + Stripe-Signature header alt Raw body passed F->>V: exact bytes + header + secret V-->>F: โœ… signature matches else JSON parsed and re-stringified F->>F: JSON.parse โ†’ JSON.stringify
(whitespace/key order changes) F->>V: different bytes V-->>F: โŒ No signatures found end

Parsing and re-serialising JSON can change spacing or formatting. Even one changed byte produces a different signature.


Fix for Next.js (App Router)

// app/api/webhooks/stripe/route.ts
import Stripe from "stripe";

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);

export async function POST(req: Request) {
  const body = await req.text();                        // โœ… raw body
  const signature = req.headers.get("stripe-signature")!;

  let event: Stripe.Event;
  try {
    event = stripe.webhooks.constructEvent(
      body,
      signature,
      process.env.STRIPE_WEBHOOK_SECRET!                 // whsec_...
    );
  } catch (err) {
    return new Response(`Webhook Error: ${(err as Error).message}`, { status: 400 });
  }

  if (event.type === "checkout.session.completed") {
    // fulfil the order (idempotently!)
  }
  return new Response("ok", { status: 200 });
}

Use req.text(), not req.json().

Fix for Express

import express from "express";
import Stripe from "stripe";

const app = express();
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);

// โœ… raw body for the webhook route ONLY, registered BEFORE express.json()
app.post("/webhooks/stripe", express.raw({ type: "application/json" }), (req, res) => {
  let event;
  try {
    event = stripe.webhooks.constructEvent(
      req.body,                                    // Buffer
      req.headers["stripe-signature"],
      process.env.STRIPE_WEBHOOK_SECRET
    );
  } catch (err) {
    return res.status(400).send(`Webhook Error: ${err.message}`);
  }
  res.json({ received: true });
});

app.use(express.json()); // other routes
Watch out: if app.use(express.json()) runs before your webhook route, the body is already parsed and the raw bytes are gone. Register the webhook route with express.raw() first.

Using the Wrong Secret

Situation Which secret to use
Local testing with stripe listen The whsec_... printed by stripe listen
Endpoint added in the Dashboard (test mode) That endpoint's signing secret, in test mode
Production (live mode) The live endpoint's signing secret

The API secret key (sk_...) is not the webhook secret. And each endpoint has its own whsec_....


Test Locally With the Stripe CLI

stripe login
stripe listen --forward-to localhost:3000/api/webhooks/stripe
# copy the whsec_... it prints into STRIPE_WEBHOOK_SECRET
stripe trigger checkout.session.completed

Other Causes

  • A proxy or middleware modifies the body (compression, body parsers, some serverless adapters)
  • Header missing or altered by a CDN or proxy
  • Server clock badly out of sync: signatures include a timestamp with a tolerance (5 minutes by default)
  • Env var not loaded in production (check your hosting dashboard)
  • Trailing whitespace copied into the secret

After Verification Works

Stripe may send the same event more than once and out of order. Make handlers idempotent: store processed event.ids and skip duplicates, and return 2xx quickly while doing slow work in the background. (See Idempotency Explained and Stripe System Design.)


Frequently Asked Questions

Why does Stripe webhook verification fail in Next.js?

Usually because the handler reads the body with req.json() or a framework parses it before verification. Read the raw body with await req.text() and pass it, with the stripe-signature header and the endpoint's whsec_ secret, to stripe.webhooks.constructEvent.

Where do I find my Stripe webhook signing secret?

In the Stripe Dashboard under Developers, Webhooks, select your endpoint and reveal its signing secret, which starts with whsec_. When testing with stripe listen, use the secret the CLI prints instead. Test and live mode endpoints have different secrets.

Can I skip webhook signature verification?

You shouldn't. Without verification, anyone could send fake events to your endpoint, for example pretending a payment succeeded. Signature verification proves the event came from Stripe and wasn't modified.


Conclusion

"No signatures found matching the expected signature" almost always means the body was parsed before verification or the wrong secret was used. Pass the raw body, the unmodified Stripe-Signature header and the correct whsec_ secret to constructEvent, test with stripe listen, then make your handler idempotent.


Sources

Last verified: 2 November 2026.


Related reads: Stripe System Design ยท Idempotency Explained ยท Next.js Server Actions Tutorial ยท Fix CORS Error

I write practical guides for developers. Follow on LinkedIn or X, or invite me to speak.