Stripe's libraries throw the same error for every signature mismatch:
No signatures found matching the expected signature for payload
That tells you the check failed, not why. The check has exactly three inputs: the raw request body, the Stripe-Signature header, and your endpoint's signing secret. One of them is wrong. Here are the causes in the order I'd check them.
How Stripe signs a webhook
The Stripe-Signature header has comma-separated parts:
t=1767225600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd -
t: when this attempt was signed, in Unix seconds. Every retry is signed again with a new one. -
v1: the HMAC-SHA256 signature, hex-encoded. There's one per active secret, so you'll see two right after you roll a secret. -
v0: a placeholder on test events. Ignore it.
To verify:
- Split the header on commas, and each part on its first
=. Keeptand everyv1. - Build the message
t + "." + rawBody. - Compute HMAC-SHA256 of that message, keyed with the whole
whsec_…secret as text, and hex-encode it. - Compare it in constant time with each
v1. Any match is valid. - Reject timestamps more than five minutes from your clock.
In Node that's:
import { createHmac, timingSafeEqual } from "node:crypto"; // rawBody must be the exact bytes received (a Buffer), not re-serialized JSON. export function verifyStripeWebhook(rawBody, headers, secret) { let timestamp; const signatures = []; for (const item of (headers["stripe-signature"] ?? "").split(",")) { const separator = item.indexOf("="); const key = item.slice(0, separator); const value = item.slice(separator + 1); if (key === "t") timestamp = value; else if (key === "v1") signatures.push(Buffer.from(value, "hex")); } if (!timestamp || !/^\d+$/.test(timestamp) || signatures.length === 0) return false; if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false; // The whole whsec_ string is the key: don't strip it or Base64-decode it. const expected = createHmac("sha256", secret) .update(timestamp + ".") .update(rawBody) .digest(); return signatures.some( (signature) => signature.length === expected.length && timingSafeEqual(signature, expected), ); } You don't need to write this yourself: stripe.webhooks.constructEvent (Node), stripe.Webhook.construct_event (Python) and webhook.ConstructEvent (Go) do the same thing. Knowing the steps is what lets you debug them.
1. The body was parsed before it was verified
This is the most common cause. The signature covers the exact bytes Stripe sent. If a JSON parser runs first, you get an object back, and serializing it again changes the bytes: whitespace, key order, and how Unicode is escaped.
Express: register the webhook route with express.raw() before the global JSON parser.
app.post("/webhooks/stripe", express.raw({ type: "application/json" }), (req, res) => { const event = stripe.webhooks.constructEvent(req.body, req.headers["stripe-signature"], secret); // ... }); app.use(express.json()); // after the webhook route Next.js App Router: read the body as text, not JSON.
export async function POST(request: Request) { const body = await request.text(); const event = stripe.webhooks.constructEvent(body, request.headers.get("stripe-signature")!, secret); // ... } Next.js Pages Router: turn off bodyParser for the route and read the raw buffer.
Flask: pass request.get_data(), not request.json. Django: use request.body.
Go: io.ReadAll the body (behind http.MaxBytesReader) and verify before json.Unmarshal.
AWS API Gateway: make sure the raw body reaches your Lambda function unchanged.
2. The secret is from a different endpoint
Every Stripe endpoint has its own whsec_ secret. Test-mode and live-mode endpoints never share one. And stripe listen prints a secret of its own, separate from any endpoint in the Dashboard.
So a secret that works locally fails in production, and the other way around. A quick check: look at "livemode" in the event body. false means a test-mode endpoint signed it.
3. The secret was changed on its way to the HMAC
Stripe uses the whole whsec_… string, prefix included, as the key. Any of these change it:
- Stripping
whsec_ - Base64-decoding the rest. That's how Standard Webhooks secrets work, so it's easy to carry over from another provider, but Stripe doesn't do it.
- Loading it from an
.envfile with quotes or a trailing newline
4. Only part of the header was checked
The header can hold more than one v1: after you roll a secret, Stripe signs with both the old and the new one while the old one is still active. Code that takes only the first v1, or compares against the whole header string, breaks exactly when you rotate.
5. The timestamp is outside the tolerance
The libraries reject anything signed more than five minutes ago. Every retry gets a fresh timestamp, so this usually means you replayed a request by hand (for example, from a saved curl command) or your server's clock has drifted. Keep it synced with NTP.
Finding which input is wrong
When you can't tell which of the three it is, compare against a known-good computation. I built a free Stripe signature checker for this: paste the header, the secret and the raw body, and it says which input doesn't match. It also catches the specific mistakes above, like a stripped whsec_ prefix or a re-encoded body. It runs in your browser, so nothing you paste is sent anywhere.
To capture a real delivery's exact bytes in the first place, point the endpoint at a webhook tester. It gives you a temporary URL, shows each request's headers and raw body, and checks the Stripe signature as requests arrive.
If you also need to send webhooks from your own product, the signature scheme comparison shows how Stripe, GitHub, Shopify, Slack and Standard Webhooks each sign theirs.
I build Cascadehook, a webhook delivery service. The tools linked above are free and don't need an account.