DevLearn
Back to Payments & Banking
payments

UPI Architecture

Unified Payments Interface — NPCI, PSP, and real-time push/pull

UPI Architecture — Overview

Unified Payments Interface — NPCI, PSP, and real-time push/pull

UPI (India) enables instant P2P/P2M via VPA (user@bank). NPCI operates the switch. PSPs (PhonePe, GPay, Paytm) connect via API. Flow: collect request → NPCI → debit/credit in real-time. UPI 2.0 adds overdraft, invoice in intent.

// UPI transaction flow
Payer App (PSP) → NPCI Switch → Payee Bank
       ↓                              ↓
  Debit Account              Credit Account
  (< 10 seconds settlement)

// UPI Intent (merchant)
upi://pay?pa=merchant@upi&pn=ShopName&am=500.00&cu=INR&tn=Order123

// UPI Collect Request
{
  "payerVpa": "user@okaxis",
  "payeeVpa": "merchant@ybl",
  "amount": "500.00",
  "txnId": "UPI202607041030001"
}

// Spring Boot — UPI callback handler
@PostMapping("/upi/callback")
public ResponseEntity<?> handleCallback(@RequestBody UpiCallback cb) {
  if ("SUCCESS".equals(cb.getStatus()))
    orderService.markPaid(cb.getTxnId());
  return ResponseEntity.ok("OK");
}
Tip: UPI chargebacks are limited vs cards — disputes go through NPCI grievance portal, not card network reason codes.