Money Movement APIs: What to Evaluate Before You Build
Post your first merchant payout
Clone the Formance Ledger on GitHub, run it locally, and post the two payout transactions from the merchant payout example.
Post your first merchant payout
Clone the Formance Ledger on GitHub, run it locally, and post the two payout transactions from the merchant payout example.
Money movement APIs (application programming interface) are the provider interfaces your platform uses to send, receive, and track funds across payment rails such as ACH (Automated Clearing House), RTP (Real-Time Payments), and SEPA (Single Euro Payments Area) Instant. Each one feeds your core ledger, and its API contract decides whether the resulting postings stay correct. Engineering leads own the integration, and finance operations inherits every mismatch.
A payout request to your provider times out, and your platform retries. The provider treats the retry as a new payment, and both go out. The financial team sees $2,450,000 leave the omnibus account twice, and nobody can say which posting is the duplicate.
Until the receiving bank returns the duplicate, your books show a balance that does not exist. Teams often compare these APIs on coverage and pricing, but the failures arrive later as duplicated, missing, or stuck money. Your integration has to rule out an instruction that runs once in intent and twice in fact.
The API's statuses must match how the payment rail actually settles. You need to distinguish submitted, settled, returned, and unknown statuses. A payment that failed once and then succeeded on retry must be labeled differently. If the provider collapses these into one "processing" or "failed" state, your ledger data drifts from reality.
"Settled" means something different on each payment rail. On ACH, an unauthorized consumer debit can be returned until the opening of business on the banking day after the 60th calendar day following settlement.
On RTP, the sending institution cannot revoke or recall a submitted payment, and settlement is final and irrevocable. On SEPA Instant, if the 10-second maximum cannot be met, the payer's PSP (payment service provider) must restore the account to its prior state. An API that reports "completed" for all three hides exactly the difference your postings depend on.
The unknown state carries the most risk. A timeout tells you nothing about whether money moved, and the timeout in the opening scenario lands in exactly this state. If the provider has no explicit unknown state, your code will guess, and a wrong guess on a payout sends real money twice or not at all.
Your mapping of provider statuses can only be as precise as the provider's states, so ask for the provider's state diagram in writing.
A retry must never move money twice. The idempotency key identifies repeat requests for the same payment and should remain valid from the first request until the final status arrives.
Batch payment rails can take days to reach that status. An ACH file that misses the 10:30 a.m. ET (Eastern Time) same-day deadline waits for the next FedACH window (2:45 p.m. or 4:45 p.m.), and the return window runs far longer. If your application retries after the key expires, the provider treats the request as a new payment.
Ask the API provider these questions:
API providers answer these differently, and the answers decide how safe a retry is. A provider that returns a fresh payment ID (identifier) for a duplicate has created a new payment.
Webhooks are where duplicate-safe requests turn into duplicate postings. Pick one layer to ensure that each event produces postings at most once, and make that layer the ledger.
Every API state change should map to a balanced double-entry posting in your core ledger. A provider status is an input to a posting, and the postings you record produce your ledger balance.
Formance is an open-source, programmable core ledger that unifies fiat and digital assets with regulatory-grade traceability. For a payout that retries or returns, it commits the postings atomically in one transaction, so they succeed or fail together.
Formance also documents idempotency keys and references for the retry case from the opening scenario.
The example is the $2,450,000 merchant payout from that scenario, written in Numscript, Formance's purpose-built language for describing financial transactions.
The accounts are @merchants:4512:available for the merchant's spendable funds, @merchants:4512:payouts:pending for the merchant's pending payout, and @platform:banks:omnibus:outbound for the platform's outbound bank boundary. The omnibus account is a single bank account holding funds on behalf of many owners.
Start with the payout amount already available to the merchant. When the API accepts the payout, the first transaction moves it from available to pending. When the payment rail settles it, a separate transaction moves the same amount from pending to the outbound bank account.
// MERCHANT_PAYOUT_PENDING
// Event: reserve the merchant's funds when the payout is accepted
send [USD/2 245000000] (
source = @merchants:4512:available
destination = @merchants:4512:payouts:pending
)
set_tx_meta("event_type", "merchant_payout_pending")
set_tx_meta("payout_id", "pyt001")
// MERCHANT_PAYOUT_SETTLED
// Event: move the reserved funds to the outbound bank boundary at settlement
send [USD/2 245000000] (
source = @merchants:4512:payouts:pending
destination = @platform:banks:omnibus:outbound
)
set_tx_meta("event_type", "merchant_payout_settled")
set_tx_meta("payout_id", "pyt001")
Between the two postings, the merchant cannot spend the $2,450,000 a second time. The balance of @merchants:4512:payouts:pending equals your in-flight funds exposure for that merchant, and the sum of all pending accounts tells you how much you expect to leave the omnibus account.
If the payout is returned, create a new posting that reverses the payout and moves the $2,450,000 from @platform:banks:omnibus:outbound back to @merchants:4512:available. Never edit an existing posting.
An immutable ledger records the correction as a separate posting, so an auditor can see the original entry followed by the reversal. Use the provider's idempotency key as the transaction reference to recognize repeated provider notifications (webhooks) and prevent duplicate postings.
The API must give you the raw data to reconcile against your core ledger: provider transaction IDs, fee and payout rows kept separate from orders, settlement dates, and historical balances. If the API can't return these, you will be reconciling payments by hand.
Providers net out fees so that a report row may be a fee, refund, adjustment, or payout rather than an order. A $10,000 settlement that nets a $290 fee arrives as one $9,710 row. Without the gross and fee rows, you cannot split it into the gross receivable and the fee, and that $290 sits unexplained in your omnibus account.
Cut-offs differ by payment rail, so settlement dates matter. The FedNow funds transfer business day starts at approximately 7:01 p.m. ET, so a payment sent at 8 p.m. on a Tuesday may belong to Wednesday's business day. Without the provider's settlement date on each row, your daily totals will not match the bank's, because the same payment lands on different days in each system.
Run these checks before you write integration code. If any check fails, a provider's API can produce duplicated, missing, or stuck money in your ledger, and a sandbox is the most cost-effective method to find that than production.
If the API is missing either of these, your ledger may have to guess a payment's real state.
A retry or a repeated webhook can post the same payment twice, so each of these checks secures a different path to that failure.
If you miss these tests, your ledger cannot safely absorb the provider's events.
If any of these checks fail, your team will match provider reports to the ledger manually.
Write the ledger rules first, then hold every provider to them. Each provider has its own statuses, retry schedule, and settlement format, so wiring events into application code first adds a new set of rules for each rail. A ledger that enforces double-entry, immutability, and idempotency gives every provider the same standard to meet.