Design a Bulk Payouts System Backed by a Double-Entry Ledger
Last updated: November 29, 2026
Quick Overview
Design a RazorpayX-style payouts service where businesses upload or call an API to pay thousands of vendors and employees via IMPS, NEFT, RTGS or UPI. Balances must never go negative, no payout may be sent twice, and every rupee must be traceable in a ledger.
Razorpay
November 29, 20260
0
0 solved
Design a RazorpayX-style payouts service where businesses upload or call an API to pay thousands of vendors and employees via IMPS, NEFT, RTGS or UPI. Balances must never go negative, no payout may be sent twice, and every rupee must be traceable in a ledger.
Payouts move the merchant's own money out of the platform, so correctness failures are direct financial loss. Razorpay interviewers look for idempotency end to end, a ledger design that makes balances provable, and handling of banks that respond late, ambiguously or not at all.
What the Interviewer Expects
- Idempotent payout creation and per-payout state machine
- Double-entry ledger with balance reservation before dispatch
- Mode selection rules by amount, time and beneficiary bank
- Handling of pending and unknown bank responses via status polling and reconciliation
- Throughput plan for a 50,000 row bulk file
- Audit, approvals workflow and fraud controls
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 bank API times out. Do you retry, and how do you know if the money left?
- How do you prevent two concurrent payouts from overdrawing the same account?
- How would you handle a reversal that arrives three days after the payout was marked processed?
- How do you shard the ledger when one large merchant dominates write volume?
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
Create single or bulk payouts with an idempotency key; optional maker-checker approval; states queued -> pending -> processing -> processed | reversed | failed; webhooks to the business; balance can...
High-Level Design
API service validates and stores the payout plus a ledger hold in one MySQL transaction. A dispatcher consumes approved payouts from a queue and calls a bank adapter (one per partner bank, each wi...