Fix Stripe webhook signature verification failures.
A signature failure means the request could not be authenticated. Check the receiving endpoint, its signing secret and the original request bytes before changing your business logic.
Start with these checks
- Match the secret to the sender. A Dashboard endpoint and a Stripe CLI listener have different signing secrets. Use the secret for the exact endpoint and environment sending this request, rather than a Stripe API key.
- Keep the body unchanged. Capture the original bytes before JSON middleware runs. Parsing and serializing again can change whitespace, escaping or key order.
- Read the right header. Pass the complete
Stripe-Signaturevalue to the verifier. Check that your proxy and adapter preserve it; do not assemble a replacement header. - Check the clock. Verify a newly sent delivery with a correctly synchronized server clock. An old captured request can fail the timestamp check even when its body is intact.
Keep secrets and full customer payloads out of logs, screenshots and support messages. Record the environment, receiving route, status and a non-sensitive event identifier instead.
A Node.js verification boundary
The open-source webhook-safe library verifies the signature before parsing the event. This function is the same source used by our executable documentation test:
import { parseStripeWebhook } from 'webhook-safe';
// Call with the original bounded request bytes and one Stripe-Signature header.
export function readStripeEvent(rawBody: Buffer, signature: string, endpointSecret: string) {
return parseStripeWebhook(rawBody, signature, { secret: endpointSecret });
}
Your HTTP adapter must bound the request size and provide the raw Buffer plus one signature-header value. Handle verification errors before calling your event handler. The library checks the event envelope; validate application-specific fields separately.
After verification, coordinate duplicate deliveries using the Stripe event ID and a shared durable store. A valid signature is not a guarantee that a delivery is new or that a business operation has run only once.
If you receive Stripe events through Cloud
In Endpoints, check that the provider is stripe and that its signing secret belongs to the Stripe destination pointing at that Cloud endpoint. A failed verification is rejected before event insertion, so it will not appear as an accepted event.
Send a fresh event, then inspect Events for that endpoint. If an event exists but delivery to your application failed, signature verification has already passed: inspect the recorded destination status and attempts using the delivery and replay guide.
Cloud forwards the accepted body rather than the original Stripe signature headers. Delivery signing is prepared for a separate rollout and must be configured per endpoint; until then your receiving application needs its own access controls. See the delivery signing guide.
Choose the part you want to operate
Use the npm library when you want to run verification and processing in your own infrastructure. Use Cloud when you want managed acceptance, forwarding, retries and event inspection.
Provider reference: Stripe signature-error troubleshooting.