Fix guides · Cursor, Claude Code, Bolt ·
Fix Stripe webhook "No signatures found matching"
No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?
This error means your webhook code checked Stripe's signature and it didn't match. Stripe signs the exact bytes it sends, so the check fails if your app parses the body as JSON before verifying, or if the whsec_ signing secret belongs to a different endpoint, mode or tool. The usual fix is to pass the untouched raw body to stripe.webhooks.constructEvent and use the signing secret for that specific endpoint.
Common causes – and how to tell which one you have
1. Body was parsed before verification
How to tell: Your handler calls req.json(), uses express.json() on all routes, or rebuilds the body with JSON.stringify before calling constructEvent. Even if it looks identical, re-serialized JSON is not byte-for-byte the same.
Fix: Read the body as raw text or bytes and pass that to constructEvent: await req.text() in a Next.js App Router route handler, or express.raw({ type: 'application/json' }) on the webhook route in Express. Only use the parsed event object that constructEvent returns.
2. Wrong webhook signing secret
How to tell: Verification fails for every event, even with a raw body. Common mix-ups are a test-mode secret used in live mode, a secret from another endpoint, the Stripe CLI secret used in production, or an API key (sk_...) instead of a signing secret (whsec_...).
Fix: Open the exact webhook endpoint in the Stripe Dashboard, in the correct mode (test or live), reveal its signing secret, and put it in STRIPE_WEBHOOK_SECRET. Each endpoint has its own secret.
3. Stripe CLI secret vs dashboard secret mixed up
How to tell: It works in production but fails locally (or the other way round). When you run stripe listen, the CLI prints its own whsec_ secret that is different from your dashboard endpoint's secret.
Fix: Use the secret printed by stripe listen in your local .env, and the dashboard endpoint's secret in your production environment variables.
4. Environment variable missing, stale or malformed
How to tell: The secret is correct in Stripe but your deployed app is reading something else: the variable isn't set on the host, has extra quotes or spaces, or you changed it without redeploying.
Fix: Log whether the secret is defined and its first few characters (never the full value), check it on your host (e.g. Vercel, Supabase secrets), remove stray quotes or whitespace, and redeploy.
5. Framework default body parser still active
How to tell: You use the Next.js Pages Router (pages/api) and the route doesn't disable the built-in body parser, so req.body is already an object.
Fix: Add export const config = { api: { bodyParser: false } } to that API route and read the raw request stream into a Buffer before calling constructEvent. Alternatively, move the webhook to an App Router route handler and use await req.text().
6. Hosting or middleware changes the body
How to tell: The code looks correct but runs on a platform or behind middleware that alters the request, for example AWS API Gateway delivering a base64-encoded body, or a proxy that rewrites JSON.
Fix: Decode the body back to its original bytes (for example, decode base64 when the platform flags it) or use the platform's raw-body field, and make sure no middleware touches the webhook route.
How to fix it
- Find your webhook handler (often app/api/webhooks/stripe/route.ts, pages/api/webhook.ts, or an Express route) and locate the stripe.webhooks.constructEvent call.
- Make sure the body passed in is raw: in a Next.js App Router route use const body = await req.text() and const sig = req.headers.get('stripe-signature'); in Express use app.post('/webhook', express.raw({ type: 'application/json' }), handler) and register it before app.use(express.json()).
- Remove any req.json(), JSON.parse or JSON.stringify that happens before constructEvent, and use only the event object it returns.
- In the Stripe Dashboard, open the exact webhook endpoint in the correct mode (test or live), reveal its signing secret, and set it as STRIPE_WEBHOOK_SECRET in your production environment, then redeploy.
- For local testing, run stripe listen --forward-to localhost:<port>/<your webhook path>, put the whsec_ secret it prints into your local .env, and restart your dev server.
- Run stripe trigger checkout.session.completed and confirm your endpoint returns 200 and no signature error appears in your logs.
Using Lovable, Bolt or v0?
In Bolt, tell the AI: "My Stripe webhook fails signature verification. Read the raw request body as text before verifying, don't parse it first, and use constructEventAsync if this runs on Supabase Edge Functions or Deno." Then copy the whsec_ signing secret from the exact endpoint in the Stripe Dashboard (check you're in the right test or live mode) into the secret store your app actually reads, such as Supabase Edge Function secrets or Vercel environment variables, and redeploy. In the Stripe Dashboard, the webhook endpoint's event delivery attempts show whether your endpoint returned an error, so you can resend an event after the fix.
Using Cursor, Claude Code or Windsurf?
Ask Cursor or Claude Code to show you every middleware and parser that runs before the webhook route, and to confirm the exact value passed to constructEvent is the unmodified raw body (a string or Buffer, not an object). Have it log whether STRIPE_WEBHOOK_SECRET is defined and starts with whsec_, without printing the full secret. Make it verify by running stripe listen --forward-to your local webhook URL, setting the printed secret, running stripe trigger checkout.session.completed, and confirming the endpoint returns 200.
The “fix” to avoid
Agents often 'fix' this by removing constructEvent and just using JSON.parse on the body, or by catching the error and returning 200 anyway. That makes the endpoint accept fake events from anyone, so an attacker could send a forged checkout.session.completed and get paid features for free. Keep verification and fix the raw body or the secret instead.
Copy-paste fix prompt for your AI coding tool
Paste this into Cursor, Claude Code, Lovable or Bolt:
My Stripe webhook fails with: "No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe?" Check in this order: 1) Is the body parsed or re-serialized before stripe.webhooks.constructEvent (req.json(), global express.json(), Next.js Pages Router bodyParser, JSON.stringify)? 2) Does STRIPE_WEBHOOK_SECRET hold the whsec_ secret for this exact endpoint and mode, with no quotes or spaces? 3) Does any middleware, proxy or base64 encoding change the body? Fix the handler to use the raw body (await req.text() in a Next.js route handler; express.raw({ type: 'application/json' }) on the webhook route registered before express.json(); constructEventAsync on Deno/Supabase Edge Functions) plus the stripe-signature header. Do not remove verification. Tell me which secret to use locally (stripe listen) vs in production (dashboard endpoint). Verify with stripe listen and stripe trigger checkout.session.completed, confirming a 200 response.
Questions people ask
Why does my Stripe webhook work locally but fail in production?
Locally you're probably using the secret printed by stripe listen, which only works for CLI-forwarded events. Production needs the signing secret of the dashboard webhook endpoint, in the matching test or live mode, set in your host's environment variables.
Can I just skip Stripe webhook signature verification?
You can, but you shouldn't. Without it, anyone who finds your webhook URL can send fake events, such as a fake successful payment, and your app will trust them.
I'm using the raw body and the right secret, why does it still fail?
Check that nothing upstream changes the body, such as a global JSON parser, middleware, or a platform that base64-encodes requests. Also confirm the deployed app actually has the new secret by redeploying after changing environment variables.
Official documentation
- Stripe: Manage webhook endpoints (signature verification)
- Stripe: Receive events in your webhook endpoint