Skip to main content
All use cases
Cross-border payoutsMarketplaces

Pay sellers in local currency, on the cheapest rail.

A marketplace pays sellers, contractors, and suppliers across Brazil, Mexico, Argentina, and Colombia. CodeSpar routes each transfer to the cheapest, fastest rail per destination — Pix, SPEI, or USDC settled to local currency via UnblockPay — and signs a revocable mandate on every cent that moves.

BeforeUSD wire → bank skims FX
AfterCheapest local rail → full amount
$56 saved
per $2k cross-border transfer
Try it in the Sandbox
Pix · SPEI · USDC
Rails compared
Per destination, by live cost
4 countries
BR · MX · AR · CO
Local-currency settlement
USDC→local
On/off-ramp
UnblockPay offramp by recipient country
Sealed
Per transfer
Mandate + route rationale ledgered
How the agent decides

It prices every rail, then pays on the winner.

For one $2,000 payout to a seller in Argentina, the route optimizer scores each eligible rail by FX cost plus settlement latency. A USD wire bleeds correspondent-bank spread; USDC sent over Circle and off-ramped to ARS through UnblockPay clears cheapest and fastest — so that's the rail it signs the mandate on.

  • Live FX + fee scoring per rail — no hard-coded provider per country
  • USDC settles to the seller's local currency via UnblockPay offramp
  • The chosen route and its rationale are sealed onto the transfer mandate

Pay seller Diego in Argentina $2,000 on the cheapest rail.

On it — scoring every eligible rail for Diego's payout by FX cost + settlement time before I sign the mandate.

codespar_pay · route optimizer$2,000 → AR
USD wire
Correspondent bank · FX spread + intermediary fees
−$58.00
2–4 days
Transferencias 3.0
Local rail · ARS bank transfer
−$11.40
same day
USDC → ARSchosen
Circle + UnblockPay · Stablecoin offramp to local currency
−$2.00
minutes
routed · saved $56 · mandate sealedrcp_xb2049
The pain

The conversation is the easy part.

Cross-border payout is a per-country plumbing problem. Each market has its own rail, its own FX spread, its own settlement window. Teams hard-code one provider, eat the spread, and have no audit trail when finance asks why a transfer cost what it did.

Wire everything in USD and let correspondent banks skim the FX

Route in local currency on the cheapest rail per destination

Hard-code one PSP per country and re-integrate when fees move

codespar_pay picks Pix / SPEI / USDC by live cost at run time

No record of why a transfer chose the rail it did

Every payout mandate-signed and sealed with the route rationale

Reconcile settlements across four providers by spreadsheet

Settlement correlation closes each transfer back to its mandate

How the agent does it

One payout verb. Every local rail.

Your agent calls codespar_pay with an amount and a destination; the route optimizer compares Pix (Asaas / Stark Bank), SPEI, and USDC (Circle) by live cost and settlement speed, then executes on the winner. When stablecoin clears cheapest, codespar_crypto_pay sends USDC and off-ramps it to the recipient's local currency through UnblockPay by counterparty country. Every transfer carries a signed, revocable mandate and lands in the audit ledger with the route it took and why.

01
Batch
Marketplace

320 payouts · BR/MX/AR/CO

02
Route
codespar_pay

Cheapest rail per country

Route optimizer
03
Pix · BR
codespar_pay

Instant · R$ spread 0

Stark Bank
04
USDC → AR
codespar_crypto_pay

Offramp to local currency

Circle + UnblockPay
05
Seal
Audit ledger

Mandate + route sealed

Architecture

Each payout enters the route optimizer, which scores every eligible rail by FX cost plus settlement latency. The winning rail's provider executes under a per-transfer mandate signed by the tenant's wallet policy; the proxy runs it; settlement correlation matches the confirmation back to the mandate and seals the receipt with the route rationale attached.

In code

A few lines. The whole loop.

cross-border-payouts.ts
const session = await codespar.sessions.create();

const results = await session.execute("codespar_pay", {
  batch: sellers.map((s) => ({
    amount: s.amountUSD,
    currency: "local",            // settle in the seller's currency
    destination: s.payoutAccount, // BR / MX / AR / CO
    optimize: "cheapest",         // Pix · SPEI · USDC by live cost
  })),
});

// each transfer: mandate-signed, executed on the winning rail,
// settlement-correlated, and sealed with the route it chose + why
$56 saved · sealedreceipt · rcp_cross-
Featured tools
codespar_pay

Outbound payout — route optimizer picks Pix, SPEI, or USDC by live cost.

codespar_crypto_pay

Sends USDC via Circle and off-ramps to local currency through UnblockPay by destination country.

Mandate engine

Every transfer signed with a revocable mandate scoped to the tenant's wallet policy.

See the meta-tool reference

Ship it this afternoon.

Open the sandbox, point a session at your providers, and run the whole loop against real rails in minutes — not the quarter it takes to build it by hand.

Cross-border payout orchestrator — CodeSpar | CodeSpar