Guides

Payments, explained one problem at a time.

Free extracts from the 42-chapter book. Each guide answers one question completely, with the diagrams and code from the chapter it came from, and the glossary defines all 193 terms. No email required.

Guides

Payment lifecyclesThe payment states every provider has, whatever they call themA payment is a state machine, not an API call. The states every provider shares, what goes wrong at each one, and why one-call thinking causes 3 AM bugs.WebhooksVerify the raw bytes, then assume the event arrives twiceRe-serialising the payload breaks the signature. The raw-bytes rule in Flask, the four steps in the order they go in, and a store that survives duplicates.ComplianceHow much PCI DSS actually applies to youPCI scope depends on whether card data touches your servers, not your size. What the levels mean and how tokenisation removes most of the burden.Fees and marginWhat card payments actually cost youThe headline rate is never the whole bill. How interchange, scheme fees and markup stack up, and which add-ons quietly change your effective rate.IdempotencyA new idempotency key on every retry is a double chargeA retried charge is a second charge unless the key stays the same. How to derive keys from your own IDs, and why the handler still needs a guard of its own.Stripe webhooksStripe sent that webhook twice, and the second one arrived firstStripe delivers at least once with no ordering guarantee. Deduplicate on the event ID, stop trusting sequence, and classify a retry before you schedule it.SCA and 3D SecureSCA is why your European checkout drops customersEvery SCA challenge costs conversion, and six PSD2 exemptions skip it. What 3DS2 changed, which exemptions apply, and who actually grants them.DunningMost churn is not a decision, it is a declined cardInvoluntary churn is 20-40% of the total, and a good sequence recovers 30-50% of it. The decline codes, the schedule, and knowing when to stop.PayPalPayPal can hold your money for 180 daysPayPal freezes funds for 21 to 180 days on new merchants and unusual volume. What sets off a hold, and the reserve that keeps it from ending you.

The whole thing

The guides are the parts. The book is the system.

Eight providers with their fees in the open, then fraud, reconciliation, scaling and compliance. Every example is Python with the error handling left in.

42chapters
1,000+pages
90+Python examples

30-day money-backInstant PDF and EPUB

Payments Playbook cover: build, integrate, scale, and optimize payment systems, by Sean Nieuwoudt and Beverley Merriman