Lesson 5 of 16
45. Design a Payment System (Stripe / UPI)

45.4 What do we store?

3 min read+10 XP
payment_intents id, merchant, amount, currency, method, state, idempotency_key (unique), created_at attempts intent_id, provider, provider_ref, state, request/response log ledger_txns txn_id (unique, e.g. "capture:pi_1"), created_at, description ledger_lines txn_id, account, amount (signed, integer) ← lines of a txn sum to zero accounts bank_clearing, merchant:{id}, revenue:fees, refunds_pending, ... outbox events to publish (webhooks, payouts) (Chapter 23)

Interviewer pushback:

  • "Where are the card numbers?" → In a separate, tightly controlled card vault (PCI DSS scope). Everything else uses tokens that are useless outside our system.

Memory code: "Intents for the story, a ledger for the money, a vault for the cards."