Stripe Webhook Signature Verification Failed
Your Stripe webhook handler fails to verify webhook signatures, rejecting legitimate webhook requests. Stripe events aren't processed, causing payment or subscription issues.
Webhook signature verification fails when the signing secret is incorrect, request body is modified, or verification code is wrong.
Error Messages You Might See
Common Causes
- Using wrong signing secret (webhook endpoint secret vs API key)
- Request body modified before verification (e.g., parsed JSON and re-stringified)
- Signing secret not loaded from environment variables
- Missing 'stripe-signature' header in request
- Webhook endpoint secret not configured correctly in Stripe dashboard
How to Fix It
Get signing secret: Stripe Dashboard > Webhooks > Your endpoint > Signing secret. Copy and set as env var: STRIPE_WEBHOOK_SECRET=whsec_...
Verify signature: Use Stripe SDK:const event = stripe.webhooks.constructEvent(body, sig, secret)
Pass raw request body (Buffer), not parsed JSON.
Correct endpoint setup: API route receives raw body. Configure Next.js to not parse JSON:export const config = { api: { bodyParser: false } }
Handle errors: If signature invalid, return 400. If valid but processing fails, return 200 (Stripe doesn't retry).
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
What's the difference between API key and webhook secret?
API key for server-to-server calls. Webhook secret for verifying incoming Stripe requests. Never mix them up.
How do I test webhooks locally?
Use Stripe CLI: 'stripe listen --forward-to localhost:3000/api/webhooks/stripe' then 'stripe trigger payment_intent.succeeded'
What should I return from webhook handler?
200 OK if processed (even if error occurs). Stripe retries 400+. If processing fails, log error but still return 200.