Webhook receiver with out-of-order events

DesignMedium35 minStripe style

Your task

Design the inbound-webhook receiver that consumes payment lifecycle events from an external processor (charge.succeeded, charge.refunded, charge.disputed). The processor guarantees at-least-once delivery, retries on any non-2xx, and does NOT guarantee order, you can receive 'refunded' before 'succeeded'. ~10,000 webhooks/sec at peak. You must apply each event to your own payment state exactly once and reach the correct final state regardless of arrival order. How do you build the receiver?

It covers

  • Webhooks
  • Dedup
  • Out of order