Stripe webhook signature verification failed means the signature your server computed did not match the one in the Stripe-Signature header, so the SDK refused the event before your code ran. One of three inputs to constructEvent is wrong: the endpoint secret, which Stripe calls the most common cause, the raw request body, or the header itself.
Stripe webhook signature verification failed: the three inputs to check
Stripe webhook signature verification fails when one of the three inputs to constructEvent is wrong: the endpoint’s signing secret, the exact bytes of the request body, or the Stripe-Signature header with its timestamp. Stripe names the wrong endpoint secret as the most common cause, so check the secret before changing any parsing code.
The check proves where the request came from because of how the value is made: Stripe computes an HMAC with SHA-256 over the timestamp, a period and the request body, keyed with the endpoint’s signing secret, so only someone holding that secret can produce a match. The same reasoning holds for any sender that signs its webhooks, and the checks every webhook endpoint runs are set out on their own page; if the word itself is new, start with what a webhook is.
Stripe’s troubleshooting page reads the failed check the same way: at least one of the three parameters passed to constructEvent() is incorrect, whether the endpoint secret, the raw request body (some frameworks change it before your code sees it, by reordering keys, stripping whitespace, converting to JSON or changing the encoding) or the Stripe-Signature header. Stripe signature verification takes the same three parameters in every language that page shows (Ruby, Python, PHP, Java, Node.js, Go and .NET), so the table below holds whichever of them your handler is written in.
| Input | What breaks it | How you can tell | The fix |
|---|---|---|---|
| The endpoint secret | Another endpoint’s secret, the test secret on the live endpoint, or the Stripe CLI’s secret loaded for a Dashboard endpoint | Every delivery to that endpoint fails, whatever the event | Load the secret of the endpoint that sent the event (next sections) |
| The raw request body | A JSON parser, a proxy or some frameworks changed the bytes: reordered keys, stripped whitespace, a JSON conversion or a new encoding | Node names a parsed JavaScript object; otherwise the same no-match message a wrong secret gives | Read the body as text or a buffer before anything parses it |
The Stripe-Signature header | The header never reached your code, it arrived mangled, or its timestamp is older than the tolerance | The library’s message names the header or the timestamp | Pass the header through untouched and keep the server clock synced |
Stripe’s guide to signature verification errors lists the same three checks. Before touching code, read what Stripe recorded: in Workbench, select the endpoint under Webhooks, open the Event deliveries tab and click an event to see the HTTP status code of each delivery attempt. A 400 that your handler returned after a failed check is a signature problem; a 2xx with nothing changed in the app is a different fault, covered in the next section.
No signatures found matching the expected signature for payload: what Stripe is telling you
Stripe’s Node library throws this no-match error when none of the signatures in the header matches the one it computed from the body and the secret you passed. It is not a Stripe outage: the event reached your server, and your server refused it.
In Stripe’s docs the full line reads:
Webhook signature verification failed. Err: No signatures found matching the expected signature for payload.
In Node, the call that throws it is stripe.webhooks.constructEvent, and the library adds a hint: “Are you passing the raw request body you received from Stripe?” Other messages point at other inputs, and the wording differs by library, so match the string before you change code.
| Library | The message | Which input it points to |
|---|---|---|
| Node (stripe-node) | The no-match message in the heading, followed by the raw-body hint | The secret or the body |
| Node (stripe-node) | Webhook payload must be provided as a string or a Buffer ... Payload was provided as a parsed JavaScript object instead. | The body: a parser ran before the check |
| Node (stripe-node) | No stripe-signature header value was provided. | The header never arrived |
| Node (stripe-node) | Timestamp outside the tolerance zone | The header’s timestamp: an old request or a fast server clock |
| Python (stripe-python) | SignatureVerificationError with the same no-match wording as Node, without the hint; for an old timestamp, Timestamp outside the tolerance zone | The secret or the body; the timestamp |
| Go (stripe-go) | webhook had no valid signature, beside webhook has no Stripe-Signature header and timestamp wasn't within tolerance | The secret or the body; the header; the timestamp |
A failed check does not lose the event straight away. While it fails, Stripe keeps retrying: in live mode for up to 3 days with exponential backoff, in a sandbox three times over a few hours. Once the fix is deployed, you can resend an event from the Dashboard up to 15 days after it was created, or with stripe events resend <event_id> --webhook-endpoint=<endpoint_id> up to 30 days. If the delivery log shows a 2xx and the app still did not change, the signature passed and the fault is further in: that is a webhook that returns 200 and changes nothing.
If live payment events are being refused, the app sells through this webhook and nobody can say which of the three inputs changed, start with a free audit: a video call where we go over with you how the endpoint and its deploys are set up and agree what to fix first. In the Production Hardening Sprint, our engineers verify the payment provider’s signatures before processing webhook payloads.
The wrong Stripe webhook signing secret: one whsec_ value per endpoint and mode
A Stripe webhook signing secret starts with the whsec_ prefix and belongs to one endpoint in one mode: a test endpoint, the live endpoint with the same URL and the Stripe CLI’s local listener all have different secrets. The prefix is the same on every one, so it never tells you which delivery a secret verifies.
Stripe generates a unique secret for each endpoint, and an endpoint used with both test and live keys gets a different secret for each. The table shows where each one comes from.
| Where the secret comes from | Which deliveries it verifies | Where it is shown |
|---|---|---|
| A sandbox endpoint registered in the Dashboard | Sandbox events sent to that endpoint’s URL | On that endpoint’s page in Workbench, behind Reveal secret |
| The live endpoint | Live events only; its secret differs from the test endpoint’s even when the URL is the same | On the live endpoint’s page, behind Reveal secret |
stripe listen with --forward-to | Events the CLI forwards to your local URL | Printed by the CLI when it starts; it does not change between restarts |
A Stripe signing secret is not an API key either: Stripe calls webhook signing secrets per-webhook secrets that your receiver uses to authenticate that webhooks came from Stripe, separate from the sk_ and rk_ keys your server uses to authenticate its own requests to Stripe. Stripe’s API keys page makes the split explicit, and a secret key pasted into the webhook variable fails every check the way a wrong whsec_ value does.
Stripe’s webhook quickstart samples, in every language it shows, read the secret from an environment variable called STRIPE_WEBHOOK_SECRET. Keep one value per environment, set where that environment’s endpoint delivers. We’d redeploy after changing it, then read the delivery log again, so the running code is known to hold the new value. The click path for finding and revealing a value is under where to find the Stripe webhook secret, and swapping test keys and secrets for live ones at launch is covered in the payment go-live checklist. Never paste a real secret into a ticket, a chat or a screenshot; in code and docs, whsec_... is enough.
The raw request body: the fix in Express, Next.js, Supabase and Firebase
The raw request body is the exact bytes Stripe sent, before any JSON parser, framework or proxy touched them. Any change, even reordered keys or different whitespace, produces a different digest, so the webhook route must read the body as text or a buffer and pass that to constructEvent.
Stripe’s webhook docs state the rule plainly: “Any manipulation to the raw body of the request causes the verification to fail.” The example code below shows Stripe webhook signature verification in four stacks: Express, Next.js, Supabase Edge Functions and Firebase. Each block follows the framework’s own docs and Stripe’s; we wrote them for this page and did not run them against a Stripe account. Every block reads the secret from STRIPE_WEBHOOK_SECRET, returns 400 when the check fails and 2xx once it passes.
Express: express.raw on the webhook route only
express.raw() parses the incoming body into a Buffer on req.body, and its type option decides which requests it reads. Express runs middleware in the order you register it, so mount the raw parser on the webhook route and register any global express.json() after that route. Express’s express.raw reference lists the options.
const app = express();
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(
req.body, req.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET);
} catch (err) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
res.sendStatus(200); // handle event.type before this line
});
app.use(express.json()); // every other route, registered after the webhook
With the order reversed, the symptom depends on what reaches the call: the parsed object itself gives Node’s “parsed JavaScript object” message, and a JSON.stringify of it gives the no-match message from the table above.
Next.js: request.text() in the App Router, bodyParser off in the Pages Router
An App Router route handler receives a standard Web Request, so await request.text() returns the body as Stripe sent it, and Next.js notes that route handlers need no bodyParser setting. Next.js route handlers show the same pattern for webhooks in general.
// app/api/webhooks/stripe/route.ts
export async function POST(request: Request) {
const body = await request.text();
const signature = request.headers.get('stripe-signature') ?? '';
try {
const event = stripe.webhooks.constructEvent(body, signature, process.env.STRIPE_WEBHOOK_SECRET!);
// handle event.type here
} catch (err) {
return new Response(`Webhook Error: ${(err as Error).message}`, { status: 400 });
}
return new Response(null, { status: 200 });
}
The Pages Router is the opposite case: its API routes parse req.body by content type by default, so the webhook route exports export const config = { api: { bodyParser: false } } and reads the stream itself. Stripe’s troubleshooting page points Pages Router users to a buffer(request) helper for that read. req.rawBody is not among the request helpers Next.js’s API routes docs list, so use one only on a platform whose docs name it, as Firebase’s do below.
Supabase Edge Functions: verify_jwt and the async verifier
This case matters for Lovable apps: Lovable Cloud is the built-in backend, covering database, auth, storage and edge functions among other parts, built on Supabase’s open-source foundation, so this section applies to a Lovable or Supabase app whose Stripe webhook runs as an Edge Function. Supabase Edge Functions verify a Supabase JWT by default; a Stripe webhook function needs verify_jwt = false under [functions.<name>] in supabase/config.toml, after which the handler is fully responsible for authenticating the caller. Stripe sends no Supabase credentials, so with the default left on, the platform refuses the request before your code runs, and Supabase documents that refusal as a 401. With it off, the signature check is the only gate.
Edge Functions run on Deno, which has no synchronous Node crypto, so Supabase’s code uses constructEventAsync with Stripe’s Web Crypto provider; the synchronous constructEvent() throws SubtleCryptoProvider cannot be used in a synchronous context there. The block follows Supabase’s Edge Functions auth guide; Supabase’s Stripe webhook example reads the body the same way.
const cryptoProvider = Stripe.createSubtleCryptoProvider();
export default {
fetch: withSupabase({ auth: 'none' }, async (req) => {
const signature = req.headers.get('stripe-signature') ?? '';
const body = await req.text();
try {
await stripe.webhooks.constructEventAsync(
body, signature, Deno.env.get('STRIPE_WEBHOOK_SECRET')!, undefined, cryptoProvider);
} catch (err) {
return new Response('bad signature', { status: 400 });
}
return Response.json({ received: true });
}),
};
Firebase Cloud Functions: req.rawBody
Firebase parses an HTTP function’s body before your handler sees it and keeps the original in req.rawBody, which its 1st gen docs describe as “The raw (unparsed) bytes of the request”. The 2nd gen functions run as Cloud Run services, and Google’s Cloud Run docs say its body parsing makes both req.body and req.rawBody available there. Pass req.rawBody to the check, never JSON.stringify(req.body). Firebase’s HTTP functions docs list the request fields.
const { onRequest } = require('firebase-functions/v2/https');
exports.stripeWebhook = onRequest(async (req, res) => {
let event;
try {
event = stripe.webhooks.constructEvent(
req.rawBody, req.headers['stripe-signature'], process.env.STRIPE_WEBHOOK_SECRET);
} catch (err) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
res.sendStatus(200); // handle event.type before this line
});
The Stripe webhook signature header name, and the timestamp tolerance
The Stripe-Signature header carries a timestamp and one or more v1 signatures; the library recomputes the signature from the timestamp and the raw body and rejects the event when the timestamp is older than its tolerance, five minutes by default. A server clock that runs fast can fail this check on valid events.
The header name is Stripe-Signature, and Stripe’s Node sample reads it as request.headers['stripe-signature']. Its value looks like t=xxx,v1=yyy,v0=zzz: t is the timestamp, v1 is the live signature scheme, and Stripe adds a fake v0 signature to test events. The signed string is the timestamp, the character ., and the raw body, hashed with HMAC SHA-256 using the endpoint’s signing secret as the key. While a rolled secret’s old value is still active, the header carries one v1 signature per active secret.
Because the timestamp is part of what is signed, nobody can change it without breaking the signature. Stripe’s advice on a drifting clock is to sync it with NTP; the tolerance can be changed with an extra parameter, but a wider tolerance is a wider window for replaying a captured request, and Stripe says never to use 0, which “disables the recency check entirely.” The full format sits in Stripe’s webhook docs. A proxy or CDN that drops the header produces the missing-header message, and one that rewrites it can produce Node’s “Unable to extract timestamp and signatures from header”.
A passing check is not the whole job: a missing check, a leaked secret, duplicates
Three things sit outside what the signature check covers.
No verification at all
A handler with no constructEvent call never throws, so it never shows this error, and it is the worse case: without verification, Stripe says, an attacker could send fake events to trigger actions like fulfilling orders or granting account access. Refusing forged events is one of the billing controls that hold before money moves. Open the webhook route in the codebase and confirm the verify call is the first thing it does with the body. On Supabase, verify_jwt = false with no signature check in the handler leaves the function open to anyone with the URL (the setting is explained under the Supabase section above).
When the signing secret leaks
In the 21 third-party apps we audited in June and July 2026, three had a real secret permanently in git history: a webhook signing secret, a live AI-provider key, and a Stripe test key with its webhook secret. Those apps were picked for audit, so the count describes them and not AI-built apps at large.
Anyone holding an endpoint’s secret can sign a forged event that passes the check, and deleting the file does not remove the secret from history. Stripe recommends rolling secrets periodically or when you suspect one is compromised; when you roll, you can expire the old secret at once or keep it active for up to 24 hours, and Stripe signs with every active secret until the old one expires. Deploy the new value before the old one expires, then confirm a delivery passes.
Replays and duplicate events
The timestamp check stops someone resending an old captured request; it does not stop a second delivery, because Stripe generates a new signature and timestamp for every retry. Stripe also does not guarantee event order, and an endpoint might occasionally receive the same event more than once (the retry window is in the error section above). Store each event.id once and skip it the second time; the full pattern is making the webhook handler idempotent. A verified event still has to change the right row, and the cancellation path is the place to check when a canceled subscription keeps access.
How to verify Stripe webhook signature checks, and prove they work
A Stripe webhook signature check is proven by failing it on purpose. Send a test event from the CLI and see it pass, then send the same body with one byte changed, with another endpoint’s secret, with no header and after the tolerance, and see each one rejected with a 400 before any business logic runs.
Run these against your own endpoint in a sandbox, and keep the message, the status code and the date for each. In check 1, log the raw body and the Stripe-Signature header your route receives; checks 2, 4 and 5 reuse them. stripe listen runs in a sandbox by default, and stripe trigger creates the API objects it needs first, so the event’s customer is a fresh test fixture, not one of your app’s users.
- 01 Run
stripe listen --forward-towith your local webhook URL, load thewhsec_secret it prints, runstripe trigger checkout.session.completed, and confirm a 2xx and the event id in your log. - 02 Send the captured body with one character changed and the same
Stripe-Signatureheader: expect a 400 and the no-match message. - 03 Restart your server with another endpoint's secret and trigger again: expect a 400 on every delivery.
- 04 Send the captured body with no
Stripe-Signatureheader: expect a 400 and the missing-header message. - 05 Send the captured valid request again more than five minutes later: expect a 400 and the timestamp message.
- 06 Check the database after each rejected request: nothing it would have changed has changed.
- 07 After deploying, open the live endpoint's Event deliveries tab, confirm the first real event shows a 2xx, and confirm the live secret differs from the test one.
For check 7, resend anything that failed before the fix, inside the resend windows given in the error section above. These checks run only against an endpoint you own. In the Production Hardening Sprint, deliverable 5.1, webhook signature verification, is verified this way: confirm valid events succeed and invalid or altered payloads are rejected. Hosting, paid tools and API usage are paid through your accounts.
Common questions about Stripe webhook signatures
How can I verify the signature of a Stripe webhook?
Pass three things to the verify call of Stripe’s official library: the raw request body, the value of the Stripe-Signature header, and the whsec_ signing secret of the endpoint that received the event. In Node that call is stripe.webhooks.constructEvent (or constructEventAsync on Deno); it throws when they do not match, and your handler should then return 400 without processing the event.
What is a secret key in Stripe?
A Stripe secret key is the server-side API key, starting sk_test_ in a sandbox or sk_live_ in live mode, that has unrestricted permissions on all Stripe APIs and must never leave your backend. It is not the webhook signing secret: that one starts whsec_ and only checks that requests to your endpoint came from Stripe.
Does Stripe support webhooks?
Yes. Stripe pushes events to the destinations you configure, which can be webhook endpoints, Amazon EventBridge or Azure Event Grid, and you create them in the Webhooks tab in Workbench or with the event destinations API. Each endpoint gets its own signing secret.
When should I get help with a Stripe webhook that fails signature checks?
Get help when live payment events keep failing after the secret, the raw body and the header all check out in a sandbox, or when nobody on the team can say which endpoint and secret production actually uses. AxonBuild offers a free audit, where we weigh up with you which input most likely changed and what to change first.
Could anyone fake a payment event to your app?
If the app accepts payment events without proof that they came from Stripe, a stranger could grant themselves a paid plan, and a broken check stops real events too. During an audit, we talk through how your payment events are handled with you and your team, and point out the risks to settle first.
Book a free audit →
Free · 30 minutes · No code access needed