Design a UPI Payment Switch with Pending and Reversal Handling

Last updated: November 29, 2026

Quick Overview

Design the backend that lets PhonePe users send UPI payments through NPCI to remitter and beneficiary banks, including how the system handles timeouts, pending states, reversals and reconciliation at festival-day peak traffic.

PhonePe
System Design
Software Engineer
PhonePe
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design the backend that lets PhonePe users send UPI payments through NPCI to remitter and beneficiary banks, including how the system handles timeouts, pending states, reversals and reconciliation at festival-day peak traffic.

This is the core of PhonePe's business: the app is a third-party UPI app that talks to NPCI through sponsor banks, and correctness under bank timeouts matters more than raw throughput. The interviewer checks a clean transaction state machine, idempotency end to end, how unknown outcomes are resolved, and a credible scaling story for peaks like Diwali or IPL nights.

What the Interviewer Expects
  • Lay out the actors: app, PSP backend, sponsor bank, NPCI, remitter and beneficiary banks
  • Define a transaction state machine with explicit unknown or pending states
  • Make every hop idempotent with a stable transaction reference
  • Resolve unknown outcomes with status-check polling and reconciliation, never by retrying the debit
  • Partition storage and processing by transaction id for scale
  • Explain user-facing behavior while a payment is pending
Key Topics to Cover
payment state machine
idempotency
reconciliation
sharding
circuit breakers
eventual consistency
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • NPCI's status check API is itself slow during an outage. How do you avoid hammering it?
  • How do you detect and react to one remitter bank failing while others are healthy?
  • What is your recovery plan if your primary data centre goes down mid-transaction?
  • How would UPI Lite (small on-device balance) change the flow?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: initiate pay (to VPA, QR, mobile), collect requests, check status, history, refunds. Non-functional: never debit twice or lose a debit; p99 initiate latency low enough that the user sees a...

High-Level Design

App calls an API gateway, then a Payments service that writes the transaction (txn id generated by us, the NPCI reference later) to a sharded MySQL cluster keyed by txn id, status INITIATED. A Switc...


Submit Your Answer
Markdown supported

Related Questions