HLD of service to create quarterly EMIs (Buy Now Pay Later system)
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2024-04-26
Problem Statement
Designing a BNPL service that allows users to purchase products instantly and pay later in quarterly EMIs. The system should handle loan creation, repayment schedules, interest calculation, notifications, and integration with merchants/banks. It must ensure reliability, security, and scalability while supporting millions of concurrent transactions.
🔶 Functional Requirements
1.User & Merchant Management
•Users can register, undergo KYC verification, and get credit eligibility.
•Merchants integrate with BNPL to offer EMI option at checkout.
2.BNPL Loan Creation
•At checkout, users can opt for BNPL → system creates a loan.
•EMI breakdown: quarterly installments (e.g., 4 payments in a year).
•EMI can include principal + interest (configurable per merchant or user profile).
3.Repayment Management
•System should generate a repayment schedule.
•Auto-debit from user’s account/wallet/UPI on due date.
•Handle partial payments and early foreclosure.
4.Notifications & Reminders
•Notify users about upcoming EMI due dates.
•Send alerts for missed payments, penalties, and successful payments.
5.Transaction Management
•Must ensure atomicity of purchase and loan creation.
•Payments must be reconciled with banks/payment gateways.
6.Risk & Credit Management
•Credit limit assignment for each user.
•Track defaults and adjust future credit eligibility.
•Merchant commission/revenue sharing.
7.Reporting & Analytics
•Merchant dashboards (sales via BNPL, settlement reports).
•User dashboards (loan history, EMI schedule, outstanding dues).
🔶 Non-Functional Requirements
•Scalability: Support millions of active users and transactions.
•Consistency: Strong consistency for financial transactions.
•Reliability: No EMI or repayment record should ever be lost.
•Security: PCI-DSS compliance, secure handling of payments.
•Availability: 99.99% uptime, especially during peak sales.
•Latency: EMI breakdown and loan creation should complete within <500ms at checkout.
🔶 Constraints
•EMI repayment dates are quarterly fixed (3 months apart).
•Loan agreements cannot be silently altered post-creation.
•Late payments → penalties and interest recalculation.
•Regulatory compliance (RBI or relevant financial authority).
•Must handle idempotency of transactions (avoid double charges).
🔶 Example Use Cases
1.User buys a ₹40,000 laptop → chooses BNPL → system creates 4 quarterly EMIs of ₹10,000 each.
2.User misses EMI → penalty applied, system retries auto-debit, and alerts user.
3.User forecloses loan after 2 installments → remaining interest waived as per policy.
4.Merchant views monthly BNPL sales report → settlement credited to merchant’s account.
5.System integrates with payment gateway to reconcile EMIs with bank transactions.
👉 Summary:
"Design a scalable BNPL system that enables users to split purchases into quarterly EMIs, ensuring secure loan creation, repayment scheduling, credit management, notifications, and financial transaction integrity at scale."