Skip to content

0021: Mark invoices and bills paid from chat, by preview and confirm ​

Context ​

ADR 0016 point 5 kept "payments against invoices" out of chat writes. SPEC-006 (Outstanding payments), the headline feature after the audit loop, needs to record in Xero that money which has already arrived or left the bank settles an invoice or bill. M4 adds preview then confirm by ID for every Xero write, and the auth layer (PR #44) and M6 log who asked and what changed.

Decision ​

Accepted by the Product Owner on 2026-09-30 (QD-18, with QD-19: the chase list never contacts customers):

  1. Supersede ADR 0016 point 5 for SPEC-006 only: payments_confirm may create Xero payments against open sales invoices and bills.
  2. Only through M4: a preview built by code, stored with an ID and expiry, confirmed once by that ID. The confirm step takes nothing else.
  3. The amount is never more than the invoice's amount due, re-read from Xero at confirm time; a changed invoice is refused.
  4. The date and bank account come from the matched bank line, never from the call.
  5. Every payment is sent with an Idempotency-Key and logged in ledger_write with who, when, and amount due before and after.
  6. No payment initiation: this records a payment that happened; it never moves money (docs/not-doing.md stands).

Consequences ​

  • The Xero app requests accounting.payments (write) in place of accounting.payments.read; each entity reconnects once.
  • Worst case, a wrong confirmed match marks the wrong invoice paid. It is visible in the log and reversible in Xero by removing the payment, which GetMy Books will not do itself.