KatInterview

Architecting a Card Network Transaction Processing Engine

System DesignModel answer
MediumModel answerSystem Designsystem-designdistributed-systemspayments

Last updated

Design a high-throughput, fault-tolerant card payment processing network that handles dual-phase payment processing, ledger auditing, and stand-in processing.

Design a global payment processing network (akin to Visa or Mastercard) that acts as the intermediary switch connecting acquiring banks (representing merchants) to issuing banks (representing cardholders).

Your system must handle the core end-to-end payment lifecycle across a globally distributed, highly available architecture.

Scope & Core Requirements

  1. Dual-Message Workflow:
    • Authorization (Real-Time): Synchronous approval phase with tight latency constraints ($<500\text{ ms}$ $p99$).
    • Clearing & Settlement (Asynchronous): Batch or stream-based multi-currency financial settlement and ledger updates at the end of the day/cycle.
  2. Resilience & Reliability:
    • Idempotency & Reversals: Guaranteed exactly-once execution semantics for retries, dropouts, and explicit auto-reversals when downstream issuers time out.
    • Stand-in Processing (STIP): Ability to evaluate rules and authorize/decline transactions on behalf of an issuer during network outages or timeout events.
  3. Ledger & Auditability:
    • Immutable double-entry bookkeeping engine ensuring zero loss of transactional integrity across acquire/issue pairs.
  4. Data Privacy & Compliance:
    • Compliance with PCI-DSS standards (tokenization/PAN isolation) and regional data sovereignty regulations.

Key Metrics to Target

  • Throughput: 10,000 peak transactions per second (TPS), scalable to 50,000 TPS.
  • Latency: $p99 \le 300\text{ ms}$ for authorizations.
  • Availability: $99.999%$ (5 nines) uptime.

Hints

Hint 1

Distinguish clearly between the synchronous authorization path and the asynchronous clearing/settlement path.

Hint 2

Design an explicit state machine for transaction lifecycles to handle retries, network dropouts, and auto-reversals.

Hint 3

Use double-entry accounting principles for the settlement ledger to ensure financial consistency.