RETURN TO SYSTEM DESIGN VAULT (55)BLUEPRINT #32 // Very Hard
#32Very HardFinTech & Transactional APIs

Design a Credit Card Processing System

ASKED IN INTERVIEWS AT:StripePaytmPayPalDatabricks

EXECUTIVE SUMMARY & PROBLEM STATEMENT

Design a PCI-DSS compliant credit card payment gateway that processes multi-currency transactions with strict idempotency, fraud detection, and zero double-charging.

SCALE ESTIMATION & TRAFFIC ENVELOPE

DAILY ACTIVE USERS / TPS5,000 transactions/sec peak, 200M transactions/day
READ / WRITE TRAFFIC RATIOTransactional write and audit stream
5-YEAR STORAGE CAPACITYHigh-integrity multi-region relational database (Spanner / CockroachDB)

FUNCTIONAL REQUIREMENTS

  • [1]Authorize, capture, and refund card payments
  • [2]Card tokenization vault (never store plain PAN in app DB)
  • [3]Webhook dispatch to merchants

NON-FUNCTIONAL REQUIREMENTS

  • •Strict idempotency (guarantee single charge on network retries)
  • •99.999% availability for payment authorization
  • •Auditability with immutable double-entry ledger

CORE ARCHITECTURAL COMPONENTS

PCI Tokenization Service
Payment Gateway API
Idempotency Lock Store (Redis)
Card Network Connector (Visa/Mastercard)
Double-Entry Ledger

DATA SCHEMA & PERSISTENCE

Charges (id, idempotency_key, amount, currency, status), LedgerEntries (id, tx_id, debit_acc, credit_acc, amount)

DISTRIBUTED TRADE-OFFS & FAILURE MODES

  • ⟡Storing cards in an isolated PCI vault reduces scope and compliance audit surface for 95% of application services.