Payment lifecycle
Generic Connector

Payment lifecycle

How a transaction's type and status become a Formance payment, which values your service can send, which statuses change the recorded amount, and why there is no status state machine.

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 typeFormance payment type
PAYINPAY-IN
PAYOUTPAYOUT
TRANSFERTRANSFER
OTHEROTHER
Wire statusFormance payment status
PENDINGPENDING
SUCCEEDEDSUCCEEDED
FAILEDFAILED
CANCELLEDCANCELLED
EXPIREDEXPIRED
REFUNDEDREFUNDED
REFUNDED_FAILUREREFUNDED_FAILURE
REFUND_REVERSEDREFUND_REVERSED
DISPUTEDISPUTE
DISPUTE_WONDISPUTE_WON
DISPUTE_LOSTDISPUTE_LOST
AUTHORISATIONAUTHORISATION
CAPTURECAPTURE
CAPTURE_FAILEDCAPTURE_FAILED
OTHEROTHER

What happens with anything outside these lists:

  • An unknown value is rejected, not mapped to OTHER. A type or status string 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 type or status becomes OTHER. This produces no error.
  • A scheme on the wire is ignored. Every Generic connector payment is recorded with scheme OTHER.

Which statuses change the amount#

Only three statuses change a payment's amount. Each one applies the transaction's own amount as a delta:

StatusEffect on the payment's amount
CAPTUREAdds the transaction's amount
REFUND_REVERSEDAdds the transaction's amount
REFUNDEDSubtracts the transaction's amount
AUTHORISATIONNo 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 statusNo 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 whose createdAt is 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 its amount or metadata has changed.
  • A transaction is only read again if its updatedAt is 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 relatedTransactionID uses its own id as the reference.
  • A transaction with relatedTransactionID uses that value as the reference. It becomes an adjustment on that payment, keeping its own id, 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, or REFUNDED as 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 for CAPTURE and REFUND_REVERSED, and zeroes it for REFUNDED. Always send the original transaction before its follow-ups.
  • Refunding by changing the original's status. Re-sending the original id with status: REFUNDED records a new adjustment and subtracts the original's full amount. For a partial refund, send a separate transaction with its own id, relatedTransactionID set to the original, and the refunded amount.
  • AUTHORISATION followed by SUCCEEDED. The amount stays at 0, because only CAPTURE adds 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 AUTHORISATION first. Then send one or more CAPTURE transactions, each with the captured amount. Each one adds to the payment's amount, so partial captures accumulate. CAPTURE_FAILED is recorded and changes nothing.
  • Refund. Send REFUNDED with the refunded amount. The payment's amount is decremented by that amount. REFUND_REVERSED adds it back, and REFUNDED_FAILURE changes nothing.
  • Dispute. DISPUTE, followed by DISPUTE_WON or DISPUTE_LOST, is recorded, and none of the three changes the amount. If a lost dispute moves funds, send the movement separately as REFUNDED.

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 statusInitiation status
SUCCEEDED, CAPTURE, REFUND_REVERSEDPROCESSED
FAILED, CANCELLED, EXPIRED, CAPTURE_FAILEDFAILED
PENDING, AUTHORISATIONPROCESSING
REFUNDEDREVERSED
REFUNDED_FAILUREREVERSE_FAILED
DISPUTE, DISPUTE_WON, DISPUTE_LOST, OTHERUNKNOWN

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 TransactionType and TransactionStatus enums in full.
  • How it Works: the polling model and the endpoints your service exposes.