Architecture & LLD

Payment Gateway

Architecture & LLD Preview

Payment Gateway

Route payments through multiple providers with retries, idempotency, and status tracking.

A PaymentGateway Adapter hides each provider's SDK; a RetryPolicy retries transient failures on the same provider before failing over to the next one in the chain, an idempotency key gates every charge before any provider is touched, and a persisted PaymentStatus makes the outcome always queryable instead of assumed.

Core Design Challenge

"Design a payment gateway that routes through multiple providers. How do you retry safely and fail over without double-charging?"

What You'll Learn:

  • Double-entry bookkeeping and ledger accuracy rules
  • ACID transaction safety, idempotency, and ledger balance consistency
  • Optimizing running balance computations for fast queries
  • Auditing, logging, and immutable historical records
Premium

Unlock “Payment Gateway”

You are viewing the concept preview. Subscribe to unlock the interactive system design visualizer, complete step-by-step walkthroughs, and code editors.

  • Every problem simulation, step-by-step
  • Full LLD pattern walkthroughs + code editors
  • HLD deep dives & real system design breakdowns
$19one-time · lifetime

Founding price for early users — locked in for life.