Building payment infrastructure at scale teaches lessons no textbook can capture. At SabPaisa, we process millions of transactions daily for educational institutions, utilities, and enterprises across India—each transaction carrying the weight of someone’s tuition payment, electricity bill, or business invoice.

The Challenge of Reliability

Payment systems demand 99.99% uptime. When a parent tries to pay their child’s school fees, failure isn’t just a technical error—it’s a broken promise. This shapes every architectural decision.

Our infrastructure handles:

  • Peak loads: 10,000+ concurrent transactions during admission seasons
  • Regulatory compliance: RBI payment aggregator licenses, PCI-DSS certification, data localization mandates
  • Multi-bank integration: 40+ partner banks with varying APIs, timeouts, and failure modes
  • Geographic distribution: Users from tier-1 cities to rural areas with spotty connectivity

Architectural Principles

1. Idempotency Everywhere

Every payment request must be safely retryable. Network failures are common—users retry, browsers resend, apps crash mid-transaction. Without idempotency, you get duplicate charges and angry customers.

@idempotent(key=lambda req: req.transaction_id)
def process_payment(request: PaymentRequest) -> PaymentResult:
    # If this transaction_id already succeeded, return cached result
    # No duplicate charges, no matter how many retries
    ...

2. Async Everything

Payment processing involves multiple hops: customer → SabPaisa → bank → payment gateway → card network → issuing bank. Synchronous requests would time out. We queue everything:

  • Customer initiates payment → Immediate transaction ID returned → Status check via webhook/polling
  • Bank callbacks → Queued for processing → Status updated asynchronously
  • Settlement reconciliation → Overnight batch jobs → Automatic retry on failure

3. Defense in Depth

Security isn’t optional in payments:

  • Encryption at rest: AES-256 for sensitive data
  • Encryption in transit: TLS 1.3 for all API calls
  • Tokenization: Never store actual card numbers (PCI-DSS requirement)
  • Rate limiting: Prevent brute-force attacks on payment APIs
  • Audit logging: Every action logged, immutable, retained for 7 years (regulatory requirement)

4. Graceful Degradation

Banks have downtime. Networks fail. Our system must handle partial failures gracefully:

  • If primary bank is down → Automatic failover to secondary bank
  • If payment gateway times out → Queue for retry with exponential backoff
  • If user’s internet drops → Transaction still processes, status checkable later

The Human Element

Technology solves 80% of the problem. The remaining 20% is understanding users:

  • SMS confirmations: Many users don’t have smartphones. SMS is reliable, universally accessible.
  • Multi-language support: English, Hindi, regional languages. Payments shouldn’t require fluency.
  • Offline fallbacks: QR codes printable for offline payment, scannable later when online.
  • Customer support integration: Every transaction linked to support tickets—quick resolution when issues arise.

Lessons for Builders

If you’re building payment systems:

  1. Test failure modes obsessively: Banks will time out. Networks will drop. Users will retry. Your system must handle chaos gracefully.

  2. Regulatory compliance from day one: Retrofitting compliance is painful. Start with RBI guidelines, PCI-DSS standards, data localization requirements.

  3. Invest in observability: You can’t fix what you can’t see. Metrics, logs, traces—non-negotiable.

  4. Design for reconciliation: Payments involve money moving between parties. Reconciliation is how you prove it moved correctly. Automate this.

  5. Respect user context: Not everyone has 4G, a smartphone, or familiarity with digital payments. Meet users where they are.

The Reward

When the system works, it’s invisible. Parents pay school fees without thinking about infrastructure. Businesses collect payments seamlessly. Utilities get paid on time.

That invisibility is the goal. Reliable infrastructure fades into the background, letting users focus on what matters—not the plumbing underneath.

Building payment systems is humbling. Every line of code carries responsibility. Every architectural decision has consequences. But when you get it right, you enable transactions that matter to millions of people. That’s worth the complexity.


This post reflects my experience building SabPaisa, an Indian payment aggregator licensed by the Reserve Bank of India. Opinions are my own and reflect technical architecture, not business strategy.