Module 04
Money in Your Database
The module this subject is actually about: what has to be true in your own tables before you are entitled to call an order paid.
5 lessons · 9 videos · 2h 51m- 04.01
Never Store Money in a Float
Store an amount as an integer in its currency's minor unit, and handle the currencies that have three decimal places or none.
- 04.02
The Webhook Is the Only Thing That Knows
Provision access from a verified server-side event rather than from a browser redirect, and say why a customer who closes the tab must still get what they paid for.
- 04.03
Idempotency, or You Will Charge Twice
Make a webhook handler safe to run twice on the same event, and explain why at-least-once delivery makes that a requirement rather than a precaution.
- 04.04
The Entitlement State Machine
Model what a customer is entitled to as its own state, separate from the payment that granted it, with grace, expiry and revocation as distinct transitions.
- 04.05
The Ledger and the Monthly Close
Record money with double-entry, append-only writes committed in one transaction, and reconcile your own numbers against the processor report and the bank.
