Skerry/ Guides

Payouts

Sending money out of a customer's wallet: to a payee's bank account, to another wallet, or to an outside address. This page covers the rails and the rule that picks one, quotes, dry run, scheduled and conditional payouts, batches, the travel rule, holds, and the remittance text each rail carries.

Status: available. USD by ACH, same-day ACH and wire, and EUR by SEPA, for every verified customer; other rails per customer. The code is lib/ops/payout.ts, lib/pure/rails.ts, lib/payout-quotes.ts, lib/scheduled-payouts.ts, lib/payout-batches.ts, lib/pure/travel-rule.ts and lib/pure/external-ref.ts.

OperationScopeIdempotency-KeyMoves moneyWhat it does
POST /customers/{id}/payeespayees:writeoptionalnoAdd a bank account as a destination for money.
GET /customers/{id}/brandcustomers:readnonenoThe business's own look on Skerry's hosted checkout and payment-link pages: logo, accent, theme, font, corner radius, language.
PUT /customers/{id}/brandcustomers:writenonenoSet that look.
GET /customers/{id}/payeespayees:readnonenoThe customer's payees, each with the receiving bank's name check (name_check) where the rail has one.
GET /customers/{id}/payees/{payee_id}payees:readnonenoOne payee, with the name check as it stands now.
DELETE /customers/{id}/payees/{payee_id}payees:writenonenoRemove a payee.
POST /customers/{id}/payees/{payee_id}/pausepayees:writeoptionalnoStop paying a payee for now without removing it.
POST /customers/{id}/payees/{payee_id}/resumepayees:writeoptionalnoPay a paused payee again.
POST /customers/{id}/payees/{payee_id}/checkpayees:writeoptionalnoAsk the receiving bank again whether the name on the account matches, and return the payee with the answer as name_check.
POST /payouts/quotepayouts:writenonenoWhat a payout would cost, as a quote that binds the instruction.
POST /payoutspayouts:writerequiredyesSend money to a payee, a wallet or an address.
POST /payouts/batchespayouts:writerequiredyesUp to 50 payouts in one call.
GET /payouts/batchespayouts:readnonenoBatches, newest first, each with the outcome of each payout in it.
GET /payouts/batches/{id}payouts:readnonenoOne batch, with the outcome of each payout in it.
GET /customers/{id}/payout-feespayouts:readnonenoWho bears the cost of a bank payout, per currency and rail: fees.usd.wire and the like, as the banking partner states them.
PATCH /customers/{id}/payout-feescustomers:writenonenoChange who bears the cost of a bank payout.
POST /customers/{id}/batch-settlement-schedulespayouts:writeoptionalnoRetired: the banking partner deprecated batch settlement schedules and named no replacement.
GET /payoutspayouts:readnonenoPayouts this project has made, with the reference each was given.
GET /payouts/{id}payouts:readnonenoOne payout and where it has got to, with amount_minor, fee_minor and authorisation.
PATCH /payouts/{id}payouts:writerequiredyesChange the amount of a payout that is still awaiting_funds; once its funds have arrived it is refused with 409 payout_not_amendable.
DELETE /payouts/{id}payouts:writenonenoCancel a payout that has not left yet.
GET /rates*nonenoThe rate between two currencies.
POST /customers/{id}/standing-ordersstanding_orders:writeoptionalyesAn address that converts and pays out whatever arrives.
GET /customers/{id}/standing-ordersstanding_orders:readnonenoThe customer's standing orders.
GET /customers/{id}/standing-orders/{standing_order_id}/conversionsstanding_orders:readnonenoWhat one standing order has converted, newest first, as the banking partner reports it: each { id, amount, currency, status, standing_order_id, occurred_at }.
GET /payouts/scheduledpayouts:readnonenoScheduled payouts, newest first.
GET /payouts/scheduled/{id}payouts:readnonenoOne scheduled payout: when it runs next, how many times it has run, the last payout it made and how the last run went.
DELETE /payouts/scheduled/{id}payouts:writenonenoCancel a scheduled payout that has not run, or stop a recurring one.
POST /payouts/{id}/releasepayouts:writeoptionalyesA person releases a conditional payout ({id} is the scheduled payout's id): it runs now, spending what was set aside for it.

Sending one

POST /payouts
Authorization: Bearer sk_test_…
Idempotency-Key: 5e88…

{ customer_id, amount | amount_minor, from: { currency, wallet_id }, to: { currency, payee_id | wallet_id | address, chain? }, rail?, speed?, quote_id?, execute_at? | schedule?: { every, unit: day|week|month, end_at? | count? } | release_on?: { event, object_id } | "approval", expires_at?, travel_rule?: { originator, beneficiary }, reference?, external_ref?, external_kind?, remittance?: { invoice_number?, amount?, date? }, dry_run? }

amount is a decimal string in from.currency; amount_minor is the same amount in integer minor units, and either may be sent. to names exactly one of payee_id, wallet_id or address. The answer carries amount_minor, fee_minor, rail, rail_reason and authorisation.

The call needs an Idempotency-Key.

A payout is checked by the spend guard as payout.create: the freeze, the customer's withdrawal allow-list, the new-payee hold and cooling-off, the risk rules, the caller's mandates and budgets. See approvals.md and mandates.md. An outside address is checked for its chain's format (Base when no chain is named) and for the coin existing on that chain before anything is sent.

DELETE /payouts/{id} cancels a payout that has not left yet: its entries in the books are reversed and what it counted against a limit or budget is given back.

PATCH /payouts/{id} with { amount } (or amount_minor) changes the amount of a payout that is still awaiting_funds; once its funds have arrived it answers 409 payout_not_amendable. It needs an Idempotency-Key. A higher amount is checked by the spend guard as payout.create for the difference, and the difference is counted under the payout, so it is given back with the rest if the payout fails, is cancelled or comes back. If the check holds it, nothing changes until the same request is sent again with Skerry-Approval. A lower amount is not checked, and what was already counted stays counted. The stored record takes the new amount, and the difference is booked in the payout's own movement.

Rails

RailCurrencyApproval the customer must holdPer-payment limitReference the payee's bank showsStatus
achUSDbase or reliance1,000,000.00 USDach_reference, 10 characters, separators removed before it is cutavailable
ach_same_dayUSDbase or reliance1,000,000.00 USDach_reference, 10 characters, separators removed before it is cutavailable
wireUSDbase or reliancenone appliedwire_message, 140 charactersavailable
fednowUSDbase or reliance10,000,000.00 USDnone carriedper customer: the payee's bank must report it
rtpUSDnonenone appliednone carriednot offered: reported on money arriving only
sepaEURsepanone appliedsepa_reference, 140 charactersavailable
faster_paymentsGBPfaster_paymentsnone appliednone carriedper customer
speiMXNspeinone appliednone carriedper customer
pixBRLpix_offramp or pixnone appliednone carriedper customer
bre_bCOPcopnone appliednone carriedper customer
co_bank_transferCOPcopnone appliednone carriedper customer

Money can arrive on more rails than a payout can leave on; account.credited carries the rail it came by.

The rule that picks one

The rule is chooseRail in lib/pure/rails.ts, a pure function, so every choice comes back with rail_reason: a code and a sentence.

  1. The currency that lands fixes the family of rails: USD (ach, ach_same_day, wire, fednow), EUR (sepa), GBP (faster_payments), MXN (spei), BRL (pix), COP (bre_b or co_bank_transfer, by the kind of payee account).
  2. A rail is usable only if the customer holds the approval for it. FedNow also needs the payee's bank to report that it can receive it; without the bank's own word it is not assumed.
  3. A named rail is used if it is usable and refused if it is not. It is never swapped for another.
  4. Otherwise, for USD, speed decides: fastest prefers fednow, then wire, then ach_same_day, then ach; cheapest prefers ach, then ach_same_day, then wire; standard, and no preference, sends by ach up to the ACH limit and by wire above it.
  5. Amount limits are applied last: a rail whose limit the amount exceeds is skipped, or refused if it was named.

Reason codes on a choice: requested, only_rail_for_currency, payee_account_kind, fastest_enabled, cheapest_enabled, standard_for_amount, above_ach_limit. A refusal names one of rail_unknown, speed_unknown, currency_unsupported, rail_wrong_currency, rail_not_offered, rail_not_enabled, rail_wrong_payee, amount_over_rail_limit, with the rails the customer is enabled for.

RTP is listed because it is asked for by name. The banking partner reports it on money arriving and does not offer it for payouts, so it is never chosen and is refused when named.

Quotes that bind

POST /payouts/quote

{ customer_id, amount | amount_minor, from, to, rail?, speed? }

The answer carries quote_id and valid_until (120 seconds by default, SKERRY_PAYOUT_QUOTE_SECONDS), the rail it would leave on and why, and for a bank payout the name check on the payee (payee_check). POST /payouts with that quote_id executes exactly the quoted customer, amount, source, destination and rail, once. A payout that does not repeat the instruction is refused with quote_mismatch (detail.field: amount, from, to or rail); a spent or lapsed quote with quote_used or quote_expired.

What is bound is the instruction and the rail. fee, rate and the receive amount are what the provider's dry run reported when the quote was made. The provider is not asked to hold them, so on a payout that converts, the amount that arrives can differ from the quote. This is not a guaranteed rate.

Dry run

Send Skerry-Dry-Run: true, or dry_run: true in the body, to check a payout without sending it. Validation, ownership, the freeze, policies, budgets, risk rules and payee rules are evaluated, and the provider's own dry run is asked. The answer is 200:

{ "dry_run": true, "next": "run" | "hold" | "refuse", "checks": [ { "check": "freeze", "result": "passed" }, … ], "object": { … } }

checks lists freeze, agent, withdrawal_allow_list, payee, risk, policy, budget and provider, each passed, held, refused or skipped. Nothing is reserved, sent or created. With the header, no Idempotency-Key is needed and no idempotency record is kept.

The body flag is declared on these operations:

OperationoperationId
POST /payoutspayouts.create
POST /payouts/batchespayouts_batches.create
PATCH /payouts/{id}payouts.update
POST /checkout-sessionscheckout_sessions.create
POST /payment-linkspayment_links.create
POST /paymentspayments.create
POST /payments/{id}/refundspayments_refunds.create
POST /settlementssettlements.create
POST /subscriptionssubscriptions.create
POST /conversionsconversions.create
POST /agent-paymentsagent_payments.create

The header also works on checkout sessions and payment links.

Scheduled and conditional payouts

POST /payouts creates a scheduled payout instead of sending now when the body states exactly one of:

FieldPlan
execute_atOnce, at a future time.
schedule: { every, unit: day | week | month, end_at? | count? }Recurring, starting at execute_at when one is given and otherwise one interval from now.
release_on: { event, object_id }Conditional: runs when a Skerry event of that type about that object is recorded.
release_on: "approval"Conditional: runs when a person calls POST /payouts/{id}/release ({id} is the scheduled payout's id). An agent's own credential is refused.

Times are UTC. A monthly schedule keeps the day of the month it started on and falls back to the last day of a shorter month.

When it is due, the worker runs it as an ordinary payout, as the key that scheduled it and under that key's mandate as it stands at that moment: limits, allow-lists, budgets, risk rules and approval holds apply then, not when it was scheduled. A frozen customer, a revoked or expired key, a revoked agent or a revoked mandate cancels the schedule, with the reason (payout.schedule_canceled).

A conditional payout sets its amount aside in the source wallet (an earmark kept by Skerry; nothing moves at the provider) until it is released, cancelled, or lapses at expires_at: 7 days by default, 90 at most. travel_rule cannot be scheduled.

GET /payouts/scheduled/{id} says when it runs next, how many times it has run, and how the last run went. DELETE /payouts/scheduled/{id} cancels one that has not run, or stops a recurring one; payouts already made are not recalled. In the sandbox, POST /sandbox/payouts/scheduled/{id}/advance runs one now, and POST /sandbox/events records a named event so a payout waiting for it is released.

Scheduled payouts and sweep rules run only while the in-process worker is on; see operations.md.

Batches

POST /payouts/batches
Idempotency-Key: c40d…

{ payouts: [ ...as POST /payouts ], reference?, dry_run? }

Up to 50 payouts. The banking partner has no bulk call, and a batch is not one. Every item is validated first, and if any is wrong nothing is sent. The batch's total, per customer and currency, is checked against the caller's daily and monthly limits before anything is sent, so a batch that could not be completed is refused whole. Then each item runs as its own payout, with its own idempotency key derived from the batch's key and the item's position, and reports its own outcome: one can be refused by a policy, held for approval or rejected by the provider while the others go through. GET /payouts/batches/{id} returns the outcome of each. A dry run checks every item and the totals and writes nothing.

Travel rule

A payout to an outside address may carry originator and beneficiary details, which the banking partner must pass on to the receiving institution:

"travel_rule": {
  "originator":  { "is_self": true },
  "beneficiary": { "is_self": false, "name": "…", "address": { "street_line_1": "…", "city": "…", … }, "wallet_type": "hosted" | "external" | "self_custodied" }
}

name is required when is_self is false. The originator may also carry identifying_information (type, number, issuing_country), birth_date and place_of_birth. Skerry validates the shape, hands it over with the payout, and keeps none of it: the audit trail records only that it was sent and whether each party was the customer itself. One exception: a payout held for approval keeps the whole request, including travel_rule, in the approval until it is decided.

States and holds

A payout is awaiting_funds, processing, on_hold, paid, undeliverable, returning, returned, return_failed or canceled. Every state the banking partner documents is mapped (lib/pure/bridge-states.ts); one it adds later is reported as unknown, which should be treated as still in progress.

While a payout is paused, status is on_hold and hold gives { reason_code, reason, deadline }. Reason codes include in_review, information_requested (with hold.compliance_request_id when the request can be read), exceeds_transaction_limits, exceeds_counterparty_limits, return_destination_missing and needs_attention. This hold is the banking partner's. A hold for a person's approval is a different thing: the payout does not exist yet, and the call answered 202; see approvals.md.

GET /payouts/{id}?wait=<seconds up to 30>&until=<state> holds the answer until the payout is paid, returned, canceled, undeliverable or return_failed, or reaches the state named.

Remittance text per rail

external_ref (up to 200 characters) with external_kind (invoice, bill, order, booking or other) names the document a payout belongs to in your system. reference and remittance: { invoice_number?, amount?, date? } are what the payee's bank shows. Each rail has its own field and its own limit (the column in the rails table above), so the text is cut to what the rail carries rather than refused. Characters the rail does not carry are removed. On ACH, text that does not fit ten characters loses its separators and spaces before it is cut, so SUP-2026-0042 leaves as SUP2026004; text that fits is sent unchanged. A SEPA reference shorter than six characters is not sent.

Payees

POST /customers/{id}/payees adds a bank account as a destination. Its body is the banking partner's external-account fields, passed on as sent: currency, account_type (us, iban or gb), the owner's name, type and address, and the account's numbers; the reference gives the full list and an example. Each payee carries the receiving bank's name check (name_check) where the rail has one. Under a mandate that covers payee.create, the operation allow-list and approval rules apply; if it is held, send the same request again with Skerry-Approval once a person has approved it.

POST /customers/{id}/payees/{payee_id}/pause stops paying a payee without removing it, and .../resume pays it again; resuming is refused with customer_frozen while the customer is frozen. .../check asks the receiving bank for the name check again and returns the payee with the answer. Each is announced as payee.updated.

A US bank can be added by logging into it instead of typing its numbers: POST /customers/{id}/bank-link returns a link_token for the bank login page, and POST /customers/{id}/bank-link/exchange with { link_token, public_token } finishes it and returns the payees it added, each announced as payee.created. A link token is finished once, and only for the customer it was started for. Finishing one is payee.create to a mandate.

Two settings are kept per customer at the banking partner and are reached through the API. GET /customers/{id}/payout-fees states who bears the cost of a bank payout, per currency and rail (fees.usd.wire, for instance), which decides whether a payee receives the amount sent or that amount less a fee; PATCH with { fees: { usd: { wire: "customer" } } } changes the entries sent and leaves the rest. The currencies, rails and values on offer are the banking partner's and are passed through as it states them. POST /customers/{id}/batch-settlement-schedules with { currency, rail } collapses the customer's bank payouts on that currency and rail into one settlement instead of one bank movement per payout; it is worth having only when one destination is paid many times a day. Neither can be changed with an agent's own credential, and both changes are written to the audit trail.

Standing conversion

POST /customers/{id}/standing-orders creates an address that converts and pays out whatever arrives: { chain, currency, delivers_to: { payee_id | wallet_id, currency?, rail? }, reference?, return_instructions?: { address, memo? } }. return_instructions says where a deposit that cannot be converted goes back to. A freeze stops new standing orders from being created.

GET /customers/{id}/standing-orders/{standing_order_id}/conversions lists what one standing order has converted, newest first, a page at a time, as the banking partner reports it.

Events

EventConcernsWhen
payout.createdpayoutA payout was created.
payout.processingpayoutA payout's funds were received and it is on its way.
payout.on_holdpayoutA payout is paused: it is being checked, or information has been asked for.
payout.canceledpayoutA payout was canceled before it left.
payout.updatedpayoutA payout changed state.
payout.paidpayoutA payout reached its destination.
payout.returnedpayoutA payout came back.
account.creditedaccountMoney arrived in a customer's account.
conversion.completedconversionA conversion settled.
wallet.createdwalletA wallet was created for a customer.
payee.createdpayeeA payee was added.
payee.updatedpayeeA payee changed: paused, resumed, or its name check came back.
payee.removedpayeeA payee was removed.
standing_order.createdstanding_orderA standing conversion was created.
standing_order.updatedstanding_orderA standing conversion changed state.
standing_order.drainedstanding_orderMoney that arrived at a standing conversion's address was converted and sent on.
balance.lowwalletA wallet's balance fell under its floor. Sent once until the balance has been back at or above it.
payout.scheduledscheduled_payoutA payout was set to run later: at a time, on an interval, or when an event arrives or a person releases it.
payout.releasedscheduled_payoutA conditional payout was released, by the event it waited for or by a person, and runs now.
payout.schedule_canceledscheduled_payoutA scheduled payout was cancelled: by request, because it lapsed, or because the key, agent, mandate or customer behind it may no longer send money. Carries the reason.

Written and kept by Skerry. Read from https://api.skerry.xyz/guides/payouts.md.

This page as Markdown