UPI-first lending, meaning small-ticket loans, instant disbursal and repayment via UPI mandate, is now the dominant pattern in Indian consumer credit. This guide is for founders, CTOs and engineering leads planning a UPI-first lending app: it walks through the architecture from KYC to disbursal, repayment and collections. Building one is not conceptually hard; building one that passes RBI inspection, scales past ₹100 crore disbursed, and does not burn capital on fraud is the actual challenge. Here is the architecture.
Key takeaways for a UPI-first lending stack
Six core services: identity, underwriting, disbursal, repayment, collections, compliance.
RBI Digital Lending Guidelines must be wired into the state machine, not appended as a "compliance check."
Use direct bank-to-bank flows; no pass-through wallets.
Repayment via UPI AutoPay (mandate) is the cleanest UX.
Observability and audit logs are first-class concerns.
Why the first six months of architecture decide your scale
The lending stack you build in months 1 to 6 dictates whether you can scale to ₹500 crore disbursed without rebuilding. Most lending startups that rebuild do so because their architecture did not anticipate compliance, scale, or fraud. Getting those three into the design early is far cheaper than retrofitting them after the loan book has grown.
The six core services of a lending app
Each service owns one stage of the loan's life and one slice of its data. The table below is the map; the sections after it go service by service.
Service | What it owns | States or key outputs |
|---|---|---|
Identity and KYC | The user record and the KYC lifecycle | NEW, IN_PROGRESS, KYC_COMPLETE, KYC_FAILED |
Underwriting | The credit decision | Yes or no, amount, rate |
Disbursal | Moving money to the borrower | APPROVED, DISBURSAL_INITIATED, DISBURSED or FAILED |
Repayment | UPI AutoPay mandates and debit attempts | Every debit attempt and its result |
Collections | Delinquency follow-up | Soft, hard and field stages |
Compliance and audit | The inspection record | Interactions, disclosures, KFS views, transitions |
1. Identity and KYC
Mobile-OTP entry. Aadhaar OKYC for basic KYC. Video KYC for full KYC. Sanction screening, PEP check. Liveness detection. Document OCR with cross-validation.
This service owns the user record and the KYC lifecycle (NEW, then IN_PROGRESS, then KYC_COMPLETE or KYC_FAILED). It writes to an immutable audit log on every state transition. Every extra step here costs completions, so our guide to KYC drop-off optimization is worth reading alongside this one.
2. Underwriting
Takes a loan application and decides yes, no, amount and rate. Pulls credit bureau data (CIBIL, Experian), pulls AA data (bank statements, MF holdings), applies your model. For the consent and data-fetch side, see our Account Aggregator integration playbook.
The underwriting service should be stateless: same input always produces the same output. Versioned models. Every decision logged with the inputs that produced it, so any decision can be replayed and explained to an inspector later.
3. Disbursal
Once approved, disburses to the borrower's bank account. Uses your payment gateway's direct-credit API. Bank-to-bank, no wallet pass-through.
State machine: APPROVED, then DISBURSAL_INITIATED, then DISBURSED or FAILED. A reconciliation job runs every 30 minutes against gateway records.
4. Repayment
UPI AutoPay mandates for recurring debits. Mandate amount capped at the maximum monthly payment; debits triggered by your service per the schedule. Our UPI integration guide covers the payment-side details.
Track every debit attempt and result. Failed debits trigger your collections workflow.
5. Collections
Soft collections (SMS, WhatsApp and email reminders) for early-stage delinquency. Hard collections (calls) for later stages. Field collection only as a last resort. All communications attributable to the regulated lender per RBI DLG.
6. Compliance and audit
A centralized log of every customer interaction, every disclosure, every Key Fact Statement shown, every state transition. Inspector-friendly format. Retention per RBI requirements. Our breakdown of what RBI Digital Lending Guidelines require of your software goes deeper on each obligation.
Cross-cutting concerns: idempotency, observability, fraud, resilience
Idempotency. Every API call must be idempotent. Disbursing the same loan twice is catastrophic, and retries from the client, the gateway and your own jobs will all happen.
Observability. Metrics on every state transition. Alerts on stuck-state loans.
Fraud. Device fingerprinting, behavioral patterns, velocity checks. Build it as a separate service that can veto any approve decision.
Multi-region. Active-active across AWS Mumbai and AWS Hyderabad for resilience.
Common pitfalls in lending app architecture
Pitfall | Why it hurts | What to do instead |
|---|---|---|
Pass-through wallet | RBI DLG explicitly prohibits it | Disburse bank-to-bank |
Underwriting in the API call | Long-running scoring blocks the request | Move it async with a state machine |
No reconciliation job | Gateway and your DB will diverge | Build recon from day one |
Single KYC provider | Vendor uptime varies | Have a fallback provider |
What we recommend: state machine first
Build the state machine first, the UX second. Most teams get this backwards. The loan state machine is the spine; everything else attaches to it. Use Temporal or AWS Step Functions if you can; they save you from writing your own state engine, and they give you retries, timeouts and a history of every transition for free.
The loan state machine is the spine; everything else attaches to it.
FAQs
Can we use a single payment gateway for both disbursal and collection?
Yes. Razorpay, Cashfree, and PayU all support both.
Do we need a banking partner license?
Yes, you operate as a Lending Service Provider in partnership with an NBFC or bank. Get this set up before V1 design.
What about co-lending?
A common pattern. Add a co-lending state branch in the architecture from day one.
Planning a lending product? See how we approach BFSI and fintech engineering, or talk to Techpuvi about lending platform engineering.
