padosoft-payments-reconciliationlisted
Install: claude install-skill padosoft/skills
# Payments and reconciliation
A payment integration that parses correctly can still be **financially impossible**. These are the checks
that make the difference, and they are almost all about a number that has to close or a boundary that has to
stay closed.
**The rule: money is a ledger of immutable events that must balance, not a status field that gets updated.**
---
## 1. The arithmetic has to close
```text
captured − refunds − lost_chargebacks = net
```
Validating an order and a payment *independently* never detects drift between them. The settlement contract
links every refund and every chargeback to the **exact** payment, distinguishes a resolved effect from an
unresolved one, and proves the equation.
And validate the state machine, not just an inequality: `refunded_amount ≤ amount` happily allows a
"partially refunded" status with a zero refund, or a "not refunded" status with a positive one. Compare
successful refund amounts against the cumulative amount observed on the payment.
## 2. The four joins that look done and are not
| Looks like proof | Is not, because |
|---|---|
| A payout total equal to an order amount | equality is not inclusion. Persist the provider's source id at commit, then verify it appears in the payout's constituent ledger |
| A payout linked to a balance transaction | that says which provider records funded it, not which of **your** orders did, nor when the bank settled |
| An open or won dispute | exposure is not a loss. Only resolved-ag