MentorNode
Start free
Commerce, Payments & LedgersHarddesign-payment-system

Design a Payment Processing System

Design money movement where a duplicate charge is a headline: idempotent charge requests, asynchronous provider webhooks, and daily reconciliation against the processor's ledger.

Idempotency KeysSagaReconciliationOutboxPCI Tokenization
Traffic & Capacity Estimates:

10k payments/second peak · 4 payment providers · zero tolerance for double charges

Functional Requirements

  • •Accept a payment intent, authorize with a provider, and capture funds, with full state tracking.
  • •Deduplicate retried charge requests by idempotency key so a client timeout never double-charges.
  • •Ingest asynchronous provider webhooks that may arrive out of order, duplicated, or late.
  • •Reconcile internal records against provider settlement files daily and flag every discrepancy.

Non-Functional Requirements

  • •Correctness beats availability: refuse a payment rather than risk charging twice.
  • •Card data must never touch your systems unencrypted — tokenize at the edge.
  • •Every state transition must be auditable and immutable after the fact.

Back-of-the-Envelope Math

  • 10k payments/second * 6 state transitions = 60k ledger writes/second at peak.
  • Reconciliation over 500M daily transactions is a batch job whose runtime must fit inside the settlement window.

Key Architectural Trade-offs

  • Synchronous capture gives the user an immediate answer and couples you to provider latency; asynchronous capture is resilient and forces a 'pending' state into the product.
  • Provider failover improves availability and breaks idempotency unless keys are scoped per provider — a retry on a second provider is a second charge.
  • Storing the provider's response verbatim makes reconciliation and disputes tractable, and makes your PCI scope and retention policy a real design constraint.

Click or drag a component onto the canvas, then connect the handles to draw the data flow.

3 nodes · 2 edges

Components · 35

Client & Edge4
Compute & Gateway7
Storage & Caching11
Messaging & Streaming6
Coordination & Ops5
Intelligence2
Canvas overview