An Indian UPI payments app also acts as a merchant acquirer through its sponsor PSP banks, so it owes merchants settlement and pays cashback from its own pool account. It processes about 900 million payments a month, and reconciliation today is a nightly batch of spreadsheets and SQL that finishes around 11 a.m. the next day. During the last sale, a consumer crash after a Kafka commit skipped 3,400 cashback credits, another bug paid 1,100 merchants twice, and nobody noticed for two days.
The interviewer asks“Design the ledger and reconciliation system for this platform. I want to know how you guarantee that no payment is lost or counted twice, even when services crash or banks time out, and how you find and fix the ones that slip through.”
Every money movement is a balanced double-entry journal in an append-only ledger, written in the same database transaction as the payment state and an outbox row, so nothing is half-done. CDC publishes the outbox to Kafka, and every consumer is idempotent by recording the event ID in the same transaction as its effect, which turns at-least-once delivery into exactly-once effects. Reconciliation is three-way — our ledger, NPCI's settlement data and the bank statement — running continuously during the day and finally per settlement cycle and end of day. Pending, deemed and unmatched items become breaks with owners, ageing and auto-resolution rules, and invariants like 'every journal sums to zero' and 'suspense balance trends to zero' are alerted in real time.
A free account unlocks the rest of it, and saves your progress across every track.