How the transactions your service returns from GET /transactions become payments and adjustments in Formance. For the shape of those transactions, see the wire contract.
What your service can send#
type and status are closed enums. Your service can send only the values below. Formance has no mapping for anything else, and no way to extend it.
Wire type | Formance payment type |
|---|---|
PAYIN | PAY-IN |
PAYOUT | PAYOUT |
TRANSFER | TRANSFER |
OTHER | OTHER |
Wire status | Formance payment status |
|---|---|
PENDING | PENDING |
SUCCEEDED | SUCCEEDED |
FAILED | FAILED |
CANCELLED | CANCELLED |
EXPIRED | EXPIRED |
REFUNDED | REFUNDED |
REFUNDED_FAILURE | REFUNDED_FAILURE |
REFUND_REVERSED | REFUND_REVERSED |
DISPUTE | DISPUTE |
DISPUTE_WON | DISPUTE_WON |
DISPUTE_LOST | DISPUTE_LOST |
AUTHORISATION | AUTHORISATION |
CAPTURE | CAPTURE |
CAPTURE_FAILED | CAPTURE_FAILED |
OTHER | OTHER |
What happens with anything outside these lists:
- An unknown value is rejected, not mapped to
OTHER. Atypeorstatusstring outside the enum fails to decode, and it fails the whole page of transactions, not just that row. The poll errors and retries, and its watermark does not advance until your service stops returning the value. - A missing or empty
typeorstatusbecomesOTHER. This produces no error. - A
schemeon the wire is ignored. Every Generic connector payment is recorded with schemeOTHER.
Which statuses change the amount#
Only three statuses change a payment's amount. Each one applies the transaction's own amount as a delta:
| Status | Effect on the payment's amount |
|---|---|
CAPTURE | Adds the transaction's amount |
REFUND_REVERSED | Adds the transaction's amount |
REFUNDED | Subtracts the transaction's amount |
AUTHORISATION | No delta. When it is the first transaction recorded for the payment, the payment is created with amount 0 and the authorized figure as its initial amount |
| Every other status | No effect. The status is recorded in the payment's history and does not change the amount |
Statuses have no state machine#
Formance does not check status transitions. Any status can follow any other, including moving backwards (for example SUCCEEDED then PENDING). Your service decides the sequence, and Formance records what it receives:
- Each distinct
(id, createdAt, status)becomes one adjustment in the payment's history. - The payment's current status is the adjustment with the latest
createdAt, not the most recently received. A follow-up whosecreatedAtis earlier than an existing adjustment is recorded, but does not become the current status. - A transaction that repeats an
(id, createdAt, status)that is already recorded is dropped as a duplicate, even when itsamountormetadatahas changed. - A transaction is only read again if its
updatedAtis strictly later than the connector's watermark. See incremental sync.
How follow-up transactions attach#
A payment is identified by (reference, type, connector):
- A transaction without
relatedTransactionIDuses its ownidas the reference. - A transaction with
relatedTransactionIDuses that value as the reference. It becomes an adjustment on that payment, keeping its ownid, status, amount, and metadata.
Because type is part of the key, every related transaction must repeat its parent's type. If it doesn't, nothing errors. You get a second payment under the same reference with a different type, and the parent's amount stays where it was.
The first transaction recorded for a payment fixes the payment itself: its initial amount, starting amount, creation time, asset, source and destination accounts, and metadata. Later transactions never update those fields. Only CAPTURE, REFUND_REVERSED, and REFUNDED deltas change the amount afterwards. No check confirms that the parent exists. If a related transaction arrives before its parent, the related transaction creates the payment.
Patterns that record a wrong amount without an error#
CAPTURE,REFUND_REVERSED, orREFUNDEDas the first transaction for a payment. The payment is created with the transaction's amount, and then the delta is applied on top. That doubles the amount forCAPTUREandREFUND_REVERSED, and zeroes it forREFUNDED. Always send the original transaction before its follow-ups.- Refunding by changing the original's status. Re-sending the original
idwithstatus: REFUNDEDrecords a new adjustment and subtracts the original's fullamount. For a partial refund, send a separate transaction with its ownid,relatedTransactionIDset to the original, and the refunded amount. AUTHORISATIONfollowed bySUCCEEDED. The amount stays at0, because onlyCAPTUREadds to it.
Common lifecycles#
In each lifecycle below, every follow-up transaction has its own id, repeats the original's type, and sets relatedTransactionID to the original's id.
- Authorize and capture. Send
AUTHORISATIONfirst. Then send one or moreCAPTUREtransactions, each with the captured amount. Each one adds to the payment's amount, so partial captures accumulate.CAPTURE_FAILEDis recorded and changes nothing. - Refund. Send
REFUNDEDwith the refunded amount. The payment's amount is decremented by that amount.REFUND_REVERSEDadds it back, andREFUNDED_FAILUREchanges nothing. - Dispute.
DISPUTE, followed byDISPUTE_WONorDISPUTE_LOST, is recorded, and none of the three changes the amount. If a lost dispute moves funds, send the movement separately asREFUNDED.
Payouts and transfers initiated through Formance#
For a payout or transfer created through Formance (POST /payouts or POST /transfers), the status of the matching payment sets the status of the initiation:
| Payment status | Initiation status |
|---|---|
SUCCEEDED, CAPTURE, REFUND_REVERSED | PROCESSED |
FAILED, CANCELLED, EXPIRED, CAPTURE_FAILED | FAILED |
PENDING, AUTHORISATION | PROCESSING |
REFUNDED | REVERSED |
REFUNDED_FAILURE | REVERSE_FAILED |
DISPUTE, DISPUTE_WON, DISPUTE_LOST, OTHER | UNKNOWN |
The Generic Connector does not write ledger postings. It records payments and their adjustments in Payments and publishes events. Turning those into ledger entries is a separate step in your integration.
See also#
- Wire contract: the
TransactionTypeandTransactionStatusenums in full. - How it Works: the polling model and the endpoints your service exposes.