Design a Payment System
Design a system that processes payments between customers and merchants through external payment providers.
Like Stripe or UPI · Hard
Functional requirements
- Accept a payment from a customer
- Pay out merchants
- Refunds
- Transaction history
Scale & non-functional requirements
- Exactly-once charging — never charge twice
- 99.99% availability
- All money movement is auditable
Hints
- Idempotency keys — where are they enforced?
- Why a double-entry ledger?
- How do you reconcile with the provider when a call times out?