Uploaded October 2026 | Updated November 2026, 14 hours ago
Five hundred rupees gone from your account, and the UPI app says: failed. So where did the money go?
System Design Interview, Day 003. Most candidates say "the bank will refund it, add a retry button". Stop there and the interviewer has already moved on, because a retry button is how you get a double payment.
The path: your app → its bank → NPCI's UPI switch → your bank debits → the receiver's bank credits → replies come back the same way. Four or five hops, and any of them can time out. The debit went through, the credit timed out, the money isn't lost, its status just isn't known. The app called it "failed". That's the bug.
- Fix 1: three states. Success, failed, pending. A timeout means pending, never failed, and the app says "Processing, don't pay again"
- Fix 2: one transaction ID from the first hop through every hop, every service idempotent on it, so no second debit
- Fix 3: ask, don't resend. Check the status with the same ID, with backoff: 5 seconds, 30 seconds, 2 minutes
- Fix 4: an append-only double-entry ledger. Debit you 500, credit a suspense account 500. Receiver confirms, suspense pays the receiver. Credit fails, a reversal row sends it back to you. Never edit, only add a row
- The pushback: what if the receiver's bank did credit, but its reply got lost? Reversing pays twice. Never decide on a missing reply: ask that bank for the status first, and reconcile every day, bank settlement file against your ledger, by ID
- The real rule: RBI's 2019 turnaround-time circular says debited but not credited means money back by T + 1 day, after that ₹100 per day of delay
Say this in the round and you stand out: three states including pending, one ID across every hop, status checks instead of resends, a double-entry ledger, daily reconciliation.
Next System Design Interview episode: design Swiggy or Zomato. Comment: how many days did your stuck UPI payment take to come back?
kgptalkie.com
#shorts #SystemDesign #SystemDesignInterview #UPI #NPCI #Payments #DoubleEntryLedger #Idempotency #BackendInterview #InterviewPrep #SoftwareEngineering #KGPTalkie
Five hundred rupees gone from your account, and the UPI app says: failed. So where did the money go?
System Design Interview, Day 003. Most candidates say "the bank will refund it, add a retry button". Stop there and the interviewer has already moved on, because a retry button is how you get a double payment.
The path: your app → its bank → NPCI's UPI switch → your bank debits → the receiver's bank credits → replies come back the same way. Four or five hops, and any of them can time out. The debit went through, the credit timed out, the money isn't lost, its status just isn't known. The app called it "failed". That's the bug.
- Fix 1: three states. Success, failed, pending. A timeout means pending, never failed, and the app says "Processing, don't pay again"
- Fix 2: one transaction ID from the first hop through every hop, every service idempotent on it, so no second debit
- Fix 3: ask, don't resend. Check the status with the same ID, with backoff: 5 seconds, 30 seconds, 2 minutes
- Fix 4: an append-only double-entry ledger. Debit you 500, credit a suspense account 500. Receiver confirms, suspense pays the receiver. Credit fails, a reversal row sends it back to you. Never edit, only add a row
- The pushback: what if the receiver's bank did credit, but its reply got lost? Reversing pays twice. Never decide on a missing reply: ask that bank for the status first, and reconcile every day, bank settlement file against your ledger, by ID
- The real rule: RBI's 2019 turnaround-time circular says debited but not credited means money back by T + 1 day, after that ₹100 per day of delay
Say this in the round and you stand out: three states including pending, one ID across every hop, status checks instead of resends, a double-entry ledger, daily reconciliation.
Next System Design Interview episode: design Swiggy or Zomato. Comment: how many days did your stuck UPI payment take to come back?
kgptalkie.com
#shorts #SystemDesign #SystemDesignInterview #UPI #NPCI #Payments #DoubleEntryLedger #Idempotency #BackendInterview #InterviewPrep #SoftwareEngineering #KGPTalkie










