Payment System
Charges, captures, refunds and payouts across an unreliable external processor, with a ledger that has to balance.
The one design where consistency beats availability, and where at-least-once plus idempotent stops being a slogan and becomes the mechanism preventing double charges.
ConsistencyWhether every reader sees the latest write, and how soon.IdempotencyRepeating a request has the same effect as doing it once.SagaA multi-step transaction undone by compensating steps on failure.OutboxWrite the event to the database with the data, then publish it.PostgresRelational SQL database, the safe default for transactional data.Core featuresACID transactionsJoins, constraints, foreign keysStrong consistencyExtensions: JSONB, PostGIS, full-textRead replicas via streaming replicationWhen to useMoney, orders, anything needing transactionsRelational data queried with joinsThe default until scale forces otherwise