
System Design: Building a Payment Gateway and Double-Entry Ledger for 100M Daily Transactions
I recently broke down the system design of a payment gateway and double-entry ledger platform handling 100M daily transactions (~5,800 peak write TPS).
The article focuses on the real-world engineering challenges: stopping accidental double-charges with distributed idempotency locks, enforcing strict double-entry bookkeeping (Debits = Credits) using insert-only tables, recovering from card network timeouts without duplicate charges, and running midnight three-way reconciliations against bank settlement files.
For those who have built financial or checkout infrastructure: what was your biggest challenge in production? How do you handle partial failures and asynchronous discrepancies across multiple bank networks?