Payment Gateway System Design (Mock Interview + Idempotency)

Design a payment gateway service like Stripe that processes payments between merchants and customers. The system should handle payment processing, refunds, webhooks, and ensure security and compliance.

Constraints

Functional

Process payment (merchant requests), multiple methods (cards, bank transfer), full/partial refunds, webhooks for events, optional stored payment methods and subscriptions, disputes and chargebacks

Non-functional

PCI-DSS, encryption of sensitive data, 99.99% uptime, strong consistency for transactions, < 2s processing, millions of transactions/day, full audit trail

Scale

10M transactions/day, peak ~500/s; ~$500M daily volume; ~2% refunds, ~0.1% disputes; ~10 GB/day, ~3.6 TB/year

Stages ahead

1Requirement Analysis
2API Design
3High-Level Design
4HLD Extensions
5Trade-offs