Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2020-10-18
Problem Statement
Design a Unified Payments Interface (UPI)-based mobile payment system that enables users to send and receive money instantly between bank accounts using their mobile numbers or virtual payment addresses (VPAs).
The system should handle real-time transactions, ensure high availability, low latency, and strong security, and be compliant with financial and regulatory requirements (e.g., NPCI, RBI guidelines).
📋 Functional Requirements
👤 User Features
1.User Registration & Authentication
•Register using phone number linked with a bank account.
•Verify identity using OTP and link to bank via UPI SDK/API.
•Create a Virtual Payment Address (VPA), e.g., username@bank.
2.Bank Account Management
•Fetch user’s linked bank accounts via UPI.
•Add or remove bank accounts.
•Set a primary account for transactions.
3.Money Transfer
•Send money via:
•VPA (user@bank)
•Phone number
•QR code (scan & pay)
•Account number + IFSC
•Receive money through UPI collect requests.
•Split bills with multiple users.
4.Transaction History
•View recent transactions, status (Success, Pending, Failed).
•Filter by date, contact, or type (debit/credit).
5.Notifications
•Real-time alerts for money sent/received.
•Transaction confirmations and reminders.
6.Security
•2FA (PIN + Device Binding).
•Device-level encryption.
•Fraud detection & limits for suspicious activity.
🏦 Admin / Backend Features
1.Transaction Routing
•Interface with NPCI’s UPI switch for request validation and settlement.
•Handle retries and transaction reconciliation.
2.Settlement & Reconciliation
•Manage inter-bank settlements via UPI and bank partners.
•Generate audit and compliance logs.
3.Dispute Management
•Allow users to raise transaction disputes or refunds.
•Data in transit — TLS 1.3 enforced for all communication.
•Device Binding — Each device tied to user credentials to prevent account sharing.
•Audit Trails — Immutable logs for all user and admin actions.
•Fraud Detection — Velocity checks, pattern analysis, and blocklisting.
🔍 Design Discussion Points
•How will you ensure idempotency in duplicate transaction requests?
•How to handle transaction retries when NPCI or bank nodes fail?
•How will you secure inter-service communication and protect PINs?
•What database schema ensures fast lookups for high-volume transactions?
•How do you achieve 5-nines availability across multiple regions?
•How can you implement real-time fraud detection at scale?
✅ Summary
Design a highly available, secure, and compliant UPI-based payment platform that enables real-time peer-to-peer and merchant transactions, ensures financial integrity, supports fraud detection, and integrates seamlessly with banking and regulatory infrastructure.