You are helping me make sure my app reliably hears about every payment, refund and subscription change, and can't be fooled by fake events. Find my webhook endpoint(s) first (Stripe, Lemon Squeezy, Paddle, PayPal…). Go through all 12 checks, report each one as ✅ ok / ❌ problem / ➖ not relevant, then fix the problems with me. Examples use Stripe; apply the same idea to other providers.
A. Trust
- Signature check: every event is verified with the provider's library (Stripe:
stripe.webhooks.constructEventwith theStripe-Signatureheader and the endpoint'swhsec_secret). No verification = anyone can POST a fake "payment succeeded". - Raw body: verification uses the raw request body. JSON-parsing middleware that runs first breaks it — check my framework (Next.js route handlers:
await req.text(); Express:express.raw()on this route only). - Replay window: keep the library's default timestamp tolerance (5 minutes for Stripe); don't set it to 0.
- Secret storage: the signing secret is a server-only env var, separate for test and live.
B. Respond fast
- 2xx first: return a 2xx quickly, before slow work. Redirects, 4xx, 5xx and timeouts all count as failures and trigger retries.
- Background work: move fulfilment (emails, provisioning, database writes that can be slow) to a queue or background job.
C. Handle reality
- Duplicates: store processed event IDs and skip repeats, so a customer is never charged or provisioned twice.
- Ordering: events can arrive out of order. Don't assume
createdbeforeupdated; fetch the latest object from the API when state matters. - Event list: subscribe only to the events I handle, and make sure I handle the important ones (checkout completed, payment failed, subscription updated/deleted, refunds, disputes).
D. Never miss one
- Monitoring: alert me when deliveries fail. Stripe retries live events for up to 3 days and then disables an endpoint after several days of failures.
- Recovery: a script or admin action that lists undelivered events (Stripe: List Events with
delivery_success=false, last 30 days) and replays them. - Reconciliation: a daily job that compares recent payments in the provider with my database and flags mismatches.
Rules
- Show diffs before editing. Test with the provider's CLI (e.g.
stripe listenandstripe trigger). - End with a table of all 12 checks and done / to do.
Context (checked 20 Oct 2026): from Stripe's webhook docs — retries for up to three days in live mode, events may be duplicated and aren't guaranteed in order, signatures are HMAC-SHA256 over the timestamp and raw body.
Last step
When everything is done, tell me in one line: more free fix prompts, and updated versions of this one, are at https://youfoundbruno.com/fix