Design Reliable Merchant Webhook Delivery With Retries and Ordering
Last updated: November 29, 2026
Quick Overview
Design the system that delivers events such as payment.captured, refund.processed and payout.reversed to merchant webhook URLs. It must survive slow or failing merchant servers, retry with backoff, let merchants verify authenticity, and never let one bad endpoint delay others.
Razorpay
November 29, 20260
0
0 solved
Design the system that delivers events such as payment.captured, refund.processed and payout.reversed to merchant webhook URLs. It must survive slow or failing merchant servers, retry with backoff, let merchants verify authenticity, and never let one bad endpoint delay others.
Many Razorpay merchants fulfil orders only when a webhook arrives, so lost or very late events become support tickets. The interviewer checks at-least-once semantics, isolation between merchants, signature verification and what ordering guarantees are realistic.
What the Interviewer Expects
- Transactional outbox so events are not lost when produced
- At-least-once delivery with exponential backoff and a retry ceiling
- Per-endpoint isolation so a slow merchant cannot block the fleet
- HMAC signatures and event ids for merchant-side dedupe
- Clear stance on ordering
- Dashboard and replay for merchants
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- A merchant's endpoint is down for six hours. What happens to their events and to everyone else?
- Can you guarantee payment.captured arrives before refund.processed? Should you?
- How would you auto-disable a webhook without hurting a merchant during a brief outage?
- How do you let a merchant replay events from last Tuesday?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Deliver each event to every subscribed endpoint for that merchant, at least once, typically within seconds. Retries for up to 24 hours. Payloads signed. Peak tens of thousands of events per second. Me...
High-Level Design
Producers write the event row in the same DB transaction as the state change (outbox). A relay publishes to Kafka partitioned by merchant id. Delivery workers fan out to endpoints and POST with `X-Sig...