UPI Payment System Design @KGPTalkie
UPI Payment System Design  @KGPTalkie
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
UPI Payment System DesignOrder State Machine: Delivered, Then Picked Up Again?Fable 5.2 vs Gemini 4 Argon: Same Score, 5x Cheaper?Nemotron 3.5 Lightning 33B vs Claude Haiku 5.5: Is Fast Also Good?BPE vs WordPiece vs SentencePiece: Whats the Difference? | LLM InterviewRTX 5090 vs Used RTX 4090 for Local AI: $2,000 for 8 GB?Qwen 3.8 27B in Just 6 GB- How Ternary Bonsai 2 WorksWhy Word Order Matters: Positional Encoding in Transformers Explained | LLM ConceptsGemini 4 Hydrogen Built 5 3D Games in One Shot. One Is Secretly BrokenLangChain Tutorial for Beginners: Vector Database and RAG IngestionSony (Sorry) Bravia: A ₹5 Crore Legal Notice for Asking for ProofSemantic Cache vs Exact Cache: How LLM Caching Works
Laxmi Kant | KGP Talkie |

UPI Payment System Design

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER