System Design: Real-Time Payment Ledger and Notifications
Design an enterprise-grade real-time payment ledger and notification pipeline using Kafka transactions, the outbox pattern, and non-blocking retry ladders.
System design rounds for Staff and Principal Engineer roles frequently ask candidates to architect mission-critical financial systems: "Design a real-time payment processing ledger with double-entry bookkeeping, strict account ordering, exactly-once consistency, and multi-channel customer notifications."
This capstone lesson synthesizes every core Kafka concept taught across the entire track—KRaft clustering, transactional outbox CDC, producer idempotence, transactional read-process-write loops, non-blocking error handling, and Prometheus observability—into a cohesive, production-grade system architecture.
01System requirements and scale
Functional requirements
- Payment processing: Ingest customer payment requests, validate balances, and execute double-entry accounting entries (debit payer, credit payee).
- Strict account ordering: Debits and credits for any individual account must process strictly in chronological order to prevent negative balance violations.
- Audit ledger: Maintain an immutable, tamper-proof record of all historical balance movements.
- Customer notifications: Send asynchronous SMS, email, and push notifications upon payment completion without slowing down transaction processing.
Non-functional requirements
- Scale: 20,000 transactions per second (TPS) peak throughput.
- Latency: 99th-percentile ledger commit latency under 200 milliseconds.
- Consistency: Zero data loss (
RPO = 0), exactly-once semantics for balance mutations, and tolerance against broker or pod failures.
Loading the rest of the lesson…