Flows

Send Statement

Move funds between ledger accounts, wallets, and payments with a Flows send stage.

The send statement is the main and most powerful stage of the Workflow definition. It moves funds between ledger accounts, wallets, and payment service providers (PSPs), handling the underlying ledger transactions automatically.

A send stage has three attributes:

  • source — where the funds come from
  • destination — where the funds go
  • amount — how much, and which asset

Both source and destination may reference a ledger account, a wallet, or a payment. Skeleton:

yaml
---
stages:
- send:
    source:
      # ...
    destination:
      # ...
    amount:
      amount: 100
      asset: "EUR/2"

Compatibility matrix#

↘ Ledger account↘ Wallet↘ Payment
↗ Ledger account✅✅✅
↗ Wallet✅✅✅
↗ Payment✅✅❌

Payment destinations work with any PSP connector configured in the Payments service — Stripe, Wise, Modulr, Banking Circle, Currency Cloud, Mangopay, and the rest. Validation is delegated to Payments, so new connectors light up here automatically.

Source types#

Ledger account#

Reference a ledger account by id (the address) and ledger (the ledger name):

yaml
source:
  account:
    id: "users:42"
    ledger: "flows-demo-001"

For cross-ledger flows you can also customize the intermediate "bridge" account via throughAccount and allow it to go negative via allowOverdraft:

FieldTypeRequiredDefaultDescription
idstringyes—Ledger account address
ledgerstringyes—Ledger name
throughAccountstringno"world"Intermediate account for cross-ledger or payment flows
allowOverdraftboolnofalseAllow unbounded overdraft on the source account
yaml
source:
  account:
    id: "users:123"
    ledger: "main"
    throughAccount: "liabilities:pending"
    allowOverdraft: true

Wallet#

Reference a wallet by either id or name. balance selects a specific balance (defaults to main):

yaml
source:
  wallet:
    id: "22d5de50-b5ef-407d-9a03-9e4fc36356f8"
    balance: "main"   # optional

Payment#

Reference an existing payment (a payin) by id:

yaml
source:
  payment:
    id: "22d5de50-b5ef-407d-9a03-9e4fc36356f8"

The payment is "ingested" — moved into a ledger as an intermediate step — before being transferred to the destination. By default this uses an internal orchestration ledger; you can override the ingestion target:

FieldTypeRequiredDefaultDescription
idstringyes—Payment ID from the Payments service
ledgerstringno"orchestration-000-internal"Ledger for payment ingestion
holdingAccountstringno"payment:{id}"Account where ingested funds are held
throughAccountstringno"world"Source account for the ingestion transaction
allowOverdraftboolnofalseAllow unbounded overdraft on throughAccount
yaml
source:
  payment:
    id: "${paymentID}"
    ledger: "main"
    holdingAccount: "assets:stripe:held"
    throughAccount: "assets:stripe:incoming"
    allowOverdraft: true

See Payment ingestion below for the full picture.

Destination types#

Ledger account#

yaml
destination:
  account:
    id: "users:42"
    ledger: "flows-demo-001"

Same throughAccount / allowOverdraft options as ledger-account sources — they govern the intermediate account used on cross-ledger transfers:

yaml
destination:
  account:
    id: "merchants:456"
    ledger: "main"
    throughAccount: "assets:incoming"
    allowOverdraft: true

Wallet#

yaml
destination:
  wallet:
    id: "22d5de50-b5ef-407d-9a03-9e4fc36356f8"

Payment#

Unlike source payments, destination payments aren't referenced by ID (the payment doesn't exist yet). Instead, you tell the stage which PSP connector to use:

yaml
destination:
  payment:
    psp: "stripe"
    type: "PAYOUT"
    sourceAccount: "${sourceAccountID}"
    metadata: "stripeConnectID"

The full field set:

FieldTypeRequiredDefaultDescription
pspstringyes—PSP connector name ("stripe", "wise", "modulr", …)
typestringno"TRANSFER""TRANSFER" or "PAYOUT"
metadatastringno—Account-metadata key carrying the destination PSP account ID
sourceAccountstringno—Explicit PSP source account ID for the transfer
connectorIDstringno—Specific connector ID (when multiple connectors of the same type exist)
waitingValidationboolnofalseWhether to wait for manual validation before settling

The ledger or wallet debit happens before the PSP transfer is initiated. On PSP failure the workflow is left in a consistent state — funds remain debited from the source until the workflow handles the failure explicitly.

Cross-ledger transfers#

When source and destination live on different ledgers, the throughAccount field on each side controls the intermediate "bridge" account used.

Same ledger (direct transfer)#

yaml
send:
  source:
    account: { id: "users:123", ledger: "main" }
  destination:
    account: { id: "merchants:456", ledger: "main" }

A single transaction posts on main from users:123 to merchants:456.

Different ledgers (bridge transfer)#

yaml
send:
  source:
    account:
      id: "users:sender"
      ledger: "ledger1"
      throughAccount: "bridge:outbound"
  destination:
    account:
      id: "merchants:receiver"
      ledger: "ledger2"
      throughAccount: "bridge:inbound"
      allowOverdraft: true

Two transactions post:

  1. On ledger1: users:sender → bridge:outbound
  2. On ledger2: bridge:inbound → merchants:receiver

bridge:inbound may need allowOverdraft: true if it isn't pre-funded.

The allowOverdraft field#

By default the Ledger requires source accounts to have sufficient funds. The special "world" account has unbounded overdraft and is used by default for bridge transactions — which is why the cross-ledger example above works without explicit overdraft when the default world bridge is in play.

When you point throughAccount at a custom account, you may need allowOverdraft: true to let the account go negative. The generated Numscript carries an allowing unbounded overdraft clause.

Example: liability tracking for payouts#

yaml
send:
  source:
    account:
      id: "users:${userID}"
      ledger: "main"
      throughAccount: "liabilities:payouts-pending"
      allowOverdraft: true
  destination:
    payment:
      psp: "stripe"
      type: "PAYOUT"

Posts as users:{userID} → liabilities:payouts-pending instead of users:{userID} → world, so the in-flight payout shows up on your liabilities account until the PSP confirms settlement.

Payment ingestion#

When the source is a payment, the funds are ingested into a ledger before being transferred to the destination. By default this happens on an internal orchestration ledger:

1. world → payment:{paymentID}   on orchestration-000-internal
2. payment:{paymentID} → world   on orchestration-000-internal (with metadata)
3. world → destination           on the destination ledger

To ingest directly into your own ledger and account scheme:

yaml
source:
  payment:
    id: "${paymentID}"
    ledger: "main"
    holdingAccount: "assets:stripe:held"
    throughAccount: "assets:stripe:incoming"
    allowOverdraft: true

Produces:

1. assets:stripe:incoming → assets:stripe:held   on main
2. assets:stripe:held → destination              on main

Complete examples#