CSE Roadmap

Core tier · about 5 hours · 8 parts

Part 2 of 8 · 2 min read

Scope and numbers

Money moves in two steps.

Think of a market stall run by an agent. A customer hands money to the agent, who holds it for the seller. Later, when the goods arrive, the agent pays the seller, minus a fee. The agent must write down every step, and the books must always add up.

Questions and the answers assumed here (from the book's sample talk).

  1. What system? The payment backend of an online store like Amazon.
  2. Which payment options? All in real life, but in this talk, credit cards.
  3. Handle cards ourselves? No. A third-party payment processor does it.
  4. Store card numbers? No, because of security rules.
  5. Global? Yes, but one currency for simplicity.
  6. Pay-outs to sellers? Yes.
  7. Anything else? Services will disagree after failures, so reconciliation is needed.

Requirements.

  • R1. Pay-in: receive money from customers on behalf of sellers.
  • R2. Pay-out: send money to sellers.
  • R3. Reliable and fault tolerant. Failed payments are handled with care.
  • R4. Internal records and the outside providers are checked against each other.

Numbers. 1 million transactions a day is 1,000,000 / 86,400 = about 12 per second. The book rounds to 10. That is tiny for a database. So the interview is about doing each payment correctly, not about volume.

Two steps for money. In pay-in, the customer's money goes through a card network into the shop's bank account. The shop does not own all of it, since part belongs to the seller. In pay-out, when conditions are met, such as delivery, money moves from the shop's account to the seller's account, minus fees.

Payment service provider (PSP)

A payment service provider is a company that moves money between accounts for you, such as by charging a card.

Example: the shop sends the PSP "charge this card $20", and the PSP talks to the card networks and banks.

Check yourself: 1. Why is the rate not the hard part? 2. What are the two steps of money flow? 3. Why does the shop not store card numbers?