Set up Stripe webhooks for charge.dispute.created and implement signature verification

domain: stripe.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Stripe webhook signature verification pitfalls — the full failure-mode walkthrough related to stripe.com, checked against official docs, with linked verified routes.

Steps

  1. Create a webhook endpoint in the Stripe Dashboard or via POST /v1/webhook_endpoints with the url pointing to your HTTPS endpoint and events including charge.dispute.created (and optionally charge.dispute.updated, charge.dispute.closed).
  2. Retrieve the webhook signing secret (whsec_...) from the Dashboard endpoint configuration; store it securely as an environment variable, never hardcode it.
  3. In your endpoint handler, read the raw request body as bytes (do not parse JSON first) and extract the Stripe-Signature header containing t= (timestamp) and v1= (HMAC-SHA256 signature) components.
  4. Verify the signature by constructing the signed payload as {timestamp}.{raw_body}, computing HMAC-SHA256 with your signing secret, and comparing the result against the v1 value in constant time to prevent timing attacks.
  5. Reject requests where the timestamp is older than your tolerance window (Stripe recommends 300 seconds) to prevent replay attacks; return HTTP 400 for invalid signatures.
  6. Return HTTP 200 immediately after signature verification before processing the event; use a background worker for dispute response logic to avoid webhook delivery timeouts.

Known gotchas

Related routes

Listen to Stripe dispute webhooks (charge.dispute.created, charge.dispute.updated, charge.dispute.closed) and automate early evidence collection
stripe.com · 5 steps · unrated
Verify Stripe webhook signatures correctly
stripe.com · 4 steps · unrated
Verify Stripe webhook signatures and implement replay-attack protection
docs.stripe.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans