Payment Checkout & Ledger Service · View 12 of 24 · Data
The load-bearing constraint
- `ledger_transaction.event_id` is unique. The event's own identity is the natural key of the transaction, so replaying the log cannot double-post and the poster needs no distributed coordination (ADR-03).
- `ledger_entry.amount_minor` is a signed integer and the entries of a transaction sum to zero, enforced at write time (ADR-02).
Decisions
- `payment_attempt` carries `policy_version` and the raw `provider_code` alongside the normalised result — the reproducibility requirement from ADR-06.
- `refund` references `reverses_txn_id`: a refund is a new transaction pointing at the original, never a reduction of it.
- `settlement_line.txn_id` is nullable. A line with no transaction is the break, and it is a row rather than a gap (ADR-07).
Not drawn
- Foreign keys carry the links the diagram does not draw — every object holds `payment_id`.
- The account tree, posting-rule versions, FX rates and the operator audit log are omitted; they are reference and evidence rather than payment structure.