Skip to content
CommonLayer
Documentation menu
On this page

ADR-0031: The ledger books the amount a provider confirms, not the amount requested

Status: Accepted (WP-14). Implemented in crates/commonlayer-funding/src/service/webhooks.rs.

Context

A provider can confirm a different amount than the checkout requested (partial payment, over-payment, bank transfers with the wrong amount), or confirm a payment after the contribution was marked failed or cancelled.

Decision

  • Money the provider confirms is always booked. When the confirmed amount differs from the requested one, gross_minor becomes the received amount, the items are re-sized pro rata with the largest-remainder method (items that round to zero are removed) and requested_minor keeps the original request.
  • A late success after failed or cancelled confirms the contribution, because the money is real. A late failure after confirmation is ignored.
  • A refund confirmation takes each item's share from its target account first; if that account was drained between request and confirmation, it continues through the dispute waterfall rather than failing the webhook forever.

Consequences

  • The ledger always equals the money held at the provider, which is what reconciliation compares (invariant L4, where the provider reports balances).
  • Contributors may see a contribution amount different from what they entered; the original request is kept for support.