Stripe webhook signature verification: fix 'No signatures found'
Stripe webhook signature verification fails when one of its three inputs is wrong: the endpoint secret, the raw request body, or the Stripe-Signature header. In practice it is almost always a secret from the wrong place (CLI vs Dashboard, test vs live) or a body that a JSON parser has already changed. Fix those two and the error "No signatures found matching the expected signature for payload" goes away.
This guide is a troubleshooting checklist in the order we would debug it, with framework fixes and a short description of what the library checks under the hood. Sources: Stripe's manage webhook endpoints page and the stripe-node webhook source, both read on 30 November 2026.
What the library checks
Every official Stripe library does the same thing inside constructEvent() (Node), construct_event() (Python, Ruby) and their equivalents:
- Parse the
Stripe-Signatureheader into a timestamptand one or morev1signatures. - Build a string from the timestamp, a dot and the raw body:
t.body. - Compute an HMAC-SHA256 of that string, keyed with your endpoint secret.
- Compare it with each
v1value using a constant-time comparison. - Reject the event if the timestamp is more than 300 seconds (5 minutes) old.
Knowing this makes the failures easy to read. Change one byte of the body, use another secret, or pass a header your framework mangled, and step 4 finds no match.
Match the error to the cause
| Error text (stripe-node) | Likely cause | First thing to check |
|---|---|---|
| No signatures found matching the expected signature for payload | Wrong secret, or body changed before verification | Secret source, then middleware order |
| Webhook payload must be provided as a string or a Buffer | You passed a parsed object (req.body after express.json()) | Use the raw body |
| Unable to extract timestamp and signatures from header | Header missing or read wrongly | Header name and how you read it |
| No signatures found with expected scheme | Header has no v1 entry | Header value, proxies that rewrite headers |
| Timestamp outside the tolerance zone | Server clock off, or an old event replayed | NTP on the server, replay tooling |
Recent stripe-node versions also add a hint when the secret contains whitespace, and some deliveries carry a short SHA-256 suffix of the body in the header so the library can tell you whether your body differs from the one Stripe sent. Treat those extras as debugging aids only. Stripe says they are not signed, so never use them to decide whether a request is genuine.
Fix it step by step
1. Use the secret for this exact endpoint
Each endpoint has its own whsec_ secret, and so does each stripe listen session. Test and live mode endpoints have different secrets too.
- Dashboard endpoint: open it in Workbench and reveal the secret.
- Local testing: use the secret printed by
stripe listen, which differs from the Dashboard one.
Print the value your server actually loads and compare. A trailing newline from a copied .env value is enough to break it. Where to find the Stripe webhook secret covers every place the secret lives and how to roll it.
2. Pass the raw body, untouched
The body must be the exact bytes Stripe sent. Any parser that turns it into an object and back changes whitespace or key order, and the HMAC no longer matches.
In Express, mount the webhook route with express.raw() before any global express.json():
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(
req.body, // a Buffer, thanks to express.raw
req.headers['stripe-signature'],
process.env.STRIPE_WEBHOOK_SECRET
);
} catch (err) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
res.sendStatus(200);
});
app.use(express.json()); // other routes, after the webhook route
With the Next.js App Router, read the body with await req.text() and pass the string. Stripe's own Next.js example does exactly this. Do not call req.json() first.
With the Next.js Pages Router, disable the built-in body parser for the route (export const config = { api: { bodyParser: false } }) and read the raw buffer.
On AWS Lambda behind API Gateway, the gateway can hand Lambda a re-serialized body. Stripe's docs show a body mapping template that passes rawBody through; verify against that field, not the parsed one.
In Flask, use request.data (raw bytes), not request.json.
3. Read the header correctly
The header looks like t=1733000000,v1=5257a8... and may carry a v0 entry for test events plus optional debug entries. Two rules from Stripe: your code must accept unknown entries, and it must not rely on a fixed number or order of entries. Pass the whole header string to the library and let it parse.
If you sit behind a proxy or a webhook relay, confirm it forwards Stripe-Signature and the body byte for byte. The stripe-node error message calls this out for third-party forwarding tools.
4. Check the clock and the runtime
A server clock that drifts more than five minutes makes every event fail with the tolerance error. Turn on NTP rather than raising the tolerance. In runtimes without Node's synchronous crypto, such as Cloudflare Workers, use constructEventAsync() instead of constructEvent().
5. Exempt the route from CSRF checks
Rails and Django add CSRF protection to POST routes by default, which blocks Stripe's requests before your code runs. Stripe's docs recommend exempting only the webhook route.
Test the fix without waiting for Stripe
You can sign a payload yourself in a unit test. stripe-node ships stripe.webhooks.generateTestHeaderString({ payload, secret }), which returns a valid header for any body and secret you choose. Feed that header and the same raw string into your handler and assert a 200. For end-to-end checks, stripe listen --forward-to localhost:3000/webhook plus stripe trigger covers the full path; how to test Stripe webhooks locally walks through that setup.
A quick checklist before you deploy:
- Production uses the Dashboard endpoint's secret for the right mode
- The webhook route receives a raw string or Buffer
- No JSON middleware runs before the webhook route
- Signature failures return 400 and are logged with the error text
- The handler returns 2xx quickly and does slow work in a queue
What not to do
Do not "fix" verification by skipping it. Without it, anyone who finds your URL can post a fake checkout.session.completed and get a free account. Stripe also publishes the IP addresses it sends webhooks from; allowlisting them is a useful extra layer, never a replacement for the signature check. If your own product sends webhooks to customers, the same HMAC pattern applies, as described in how to add webhooks to a SaaS API.
Frequently asked questions
Why does Stripe signature verification work locally but fail in production?
Locally you verify with the secret printed by stripe listen. Production events are signed with the Dashboard endpoint's secret, so set that value in the production environment.
Can I verify a Stripe webhook signature without the Stripe library?
Yes. Compute HMAC-SHA256 of timestamp + "." + raw body with the endpoint secret, compare it to the v1 value in constant time, and reject old timestamps. The libraries do the same and handle edge cases, so prefer them.
Does the timestamp tolerance cause failures on retries?
Retried deliveries are signed again when they are sent, so a correct clock keeps them inside the 5-minute window. Persistent tolerance errors point to server clock drift or replayed requests.
Should I return 400 or 500 when verification fails?
Return 400. A 4xx tells you and Stripe's delivery log that the request was rejected, and Stripe will retry the event later, which gives you time to deploy a fix.