Design Smart Routing of Card and UPI Payments Across Acquiring Banks
Last updated: November 29, 2026
Quick Overview
Design the routing layer that, for each incoming payment, picks which acquiring bank, terminal or UPI PSP to send it to so that success rate is maximised while respecting cost, merchant preferences and bank outages. It must decide within a few milliseconds on the payment path.
Razorpay
November 29, 20260
0
0 solved
Design the routing layer that, for each incoming payment, picks which acquiring bank, terminal or UPI PSP to send it to so that success rate is maximised while respecting cost, merchant preferences and bank outages. It must decide within a few milliseconds on the payment path.
Success rate is the metric Razorpay merchants care about most, and individual banks and PSPs degrade without warning, especially during sale events. The interviewer probes real-time health signals, the explore and exploit trade-off, and keeping the routing decision off the critical latency path.
What the Interviewer Expects
- Separate a fast in-process decision from an asynchronous health computation
- Define health per gateway, method, issuer bank and BIN range over sliding windows
- Handle exploration so recovered gateways get traffic again
- Respect hard constraints: merchant contracts, tokenisation support, MCC rules
- Plan for retries on a different route without double charging
- Discuss observability and safe rollout of routing rules
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
- How do you distinguish a bank outage from a burst of customers entering wrong OTPs?
- How would you A/B test a new routing policy without hurting merchant success rates?
- What happens if the health service itself is down?
- How do cost differences between acquirers enter the objective?
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
Functional: given payment attributes (method, card network, issuer, BIN, amount, merchant, UPI app) return an ordered list of eligible routes. Non-functional: p99 decision under 5 ms, tens of thousand...
High-Level Design
- Eligibility filter: rules from merchant config (terminals, MCC, international support, recurring support) produce candidates. 2. Scorer: ranks candidates by expected success rate minus a co...