Group
  • Payments

    Make webhook processing reliable under failure

    Adds retry-safe handlers, correct response codes, and a reconciliation path for events your app missed.

    • Improve quality
    • Automate workflows
    • Advanced
    • General

Free Prompt

Harden my payment webhook handling for real-world failure modes. Review the handler for my payment provider's events. Implement: respond quickly (acknowledge within a few seconds) and do heavy work asynchronously, since providers disable endpoints that time out; return accurate status codes (2xx only when the event was durably recorded, 5xx when processing failed so the provider retries, and never swallow errors into a 200); handle events arriving out of order (a subscription.updated arriving before the subscription.created; look up current state from the provider when order matters instead of applying events blindly); store raw events for replay and debugging; and add a periodic reconciliation job that pulls recent events from the provider's API and checks I processed each one, catching whatever webhooks missed entirely (downtime, misconfiguration, the week the endpoint was broken). Don't process payment-side effects (granting access, sending receipts) more than once per event; keep the idempotency work intact. Don't trust event payloads for amounts without matching them against my own records. Deliver: the hardened handler with response semantics, the async processing split, the event log, the reconciliation job, and verification: kill the app, send test events, restart, and confirm reconciliation picks up what was missed.

What This Does / How This Helps

Makes webhook processing survive reality: timeouts, out-of-order events, redeliveries, and the days your endpoint was down without anyone noticing. Webhooks are the nervous system of payment state, and they're unreliable in both directions. Providers retry, deliver out of order, and disable slow endpoints. Your server has deploys and outages. Without durability and reconciliation, subscription state silently drifts from the truth: users paying who lost access, users not paying who kept it. The reconciliation job is the safety net that matters most: it catches the events that never arrived at all, which no amount of handler hardening can fix.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts