UniversalEscrow
DocumentationAPI reference

Accept a payment

One escrow per order: your server creates it, the buyer funds it at the hosted checkout, and a signed webhook tells you it is paid. This page covers every option on the way.

Instant payments for digital goods

Everything below describes the default, settlementMode: "ESCROW". For digital goods delivered the moment the buyer pays, send "settlementMode": "INSTANT" when you create the order, or choose Instant when you create a payment link in the dashboard. The mode is part of the order terms we sign, so the buyer cannot change it, and the checkout tells the buyer before paying that the payment is not escrow-protected.

  • The buyer's payment pays the seller (amount minus the 1% fee) and the platform fee in one transaction. Nothing is held.
  • The order goes from CREATED straight to PAID. You receive escrow.paid instead of escrow.funded, with settlementMode, platformFeeAtomic and sellerAmountAtomic. Deliver on that webhook.
  • There is no release, no buyer dispute and no buyer refund-after-expiry, and platform staff cannot claw a payment back.
  • Refunds are yours to send, in part or in full, from your own wallet. Each confirmed refund sends escrow.payment_refunded and the order stays PAID.

Decide first: what “paid” means for you

With escrow, the money never enters your balance. It sits in the contract and, on release, goes straight to the seller's wallet. If your platform keeps balances or schedules payouts when an order is paid, an escrow payment must skip both, or your books will show money you do not hold and a payout you will never make. Record it as its own payment method (for example escrow) and agree with whoever owns your accounting:

  1. Which orders offer “Pay with crypto”. Start with the simplest kind.
  2. What a crypto payment does to your ledger, receipts and invoices.
  3. Who carries the 1% fee. The seller receives 99% of the amount: gross it up, absorb it, or tell the seller.

1. Create the escrow, server-side

When the buyer chooses to pay with crypto, call POST /v1/escrows from your backend. Your API key needs the escrows:write scope and must never reach a browser.

cURL
curl -sS "$ESCROW_API_BASE/escrows" \
  -H "Authorization: Bearer $ESCROW_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: order_4471_110000000' \
  -d '{
    "amount": "110000000",
    "currency": "USDC",
    "sellerWallet": "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",
    "externalReference": "order-4471",
    "description": "Logo design, order 4471",
    "successUrl": "https://shop.example/orders/4471/paid",
    "cancelUrl": "https://shop.example/orders/4471",
    "fundingDeadline": "2026-12-08T00:00:00.000Z",
    "expiresAt": "2027-01-31T00:00:00.000Z",
    "metadata": { "orderId": "4471" }
  }'
FieldMeaning
amountRequiredAtomic units as a string. USDC has 6 decimals: "110000000" is 110 USDC. Never a float.
currencyRequired"USDC", the only accepted value.
sellerWalletOne of twoThe seller's wallet address. Trusted exactly as given.
sellerWalletIdOne of twoA wallet the seller proved they control (swal_…). Preferred; see verified seller wallets. Send this or sellerWallet, never both.
buyerWalletOptionalLeave it out and whichever wallet pays becomes the buyer. Send it only to lock the escrow to one wallet.
externalReferenceOptionalYour order id, up to 128 characters, unique in your organization. Comes back on every read and webhook.
descriptionOptional1–500 characters of plain text. The checkout shows it to the buyer as what they are paying for.
successUrlOptionalAbsolute URL, up to 2048 characters, no username or password. https with a live key; a test key also accepts http.
cancelUrlOptionalSame rules as successUrl.
fundingDeadlineOptionalRFC 3339. The payment window: unfunded by then, the escrow expires. Defaults to expiresAt.
expiresAtOptionalRFC 3339. The refund lock: from then on the buyer may refund a funded escrow themselves.
metadataOptionalString keys and values, echoed on every read and webhook. Never shown to the buyer.

A field not listed here is refused with 422 validation_failed rather than silently dropped. You never send a fee: it is computed and fixed when the escrow is created, so a later fee change never alters a deal already agreed.

What you get back

201 Created
{
  "id": "esc_01M1MD43G9ZRNVVHV25TQ85MCD",
  "status": "CREATED",
  "environment": "test",
  "amountAtomic": "110000000",
  "platformFeeAtomic": "1100000",
  "token": { "symbol": "USDC", "decimals": 6 },
  "parties": [{ "type": "SELLER", "walletAddress": "0x3C44…93BC" }],
  "externalReference": "order-4471",
  "fundingDeadline": "2026-12-08T00:00:00.000Z",
  "expiresAt": "2027-01-31T00:00:00.000Z",
  "checkoutUrl": "https://<checkout host>/checkout/esc_01M1MD43G9ZRNVVHV25TQ85MCD",
  "links": {
    "checkout": "https://<checkout host>/checkout/esc_01M1…",
    "release": "https://<checkout host>/…",
    "sellerRefund": "https://<checkout host>/…",
    "buyerRefund": "https://<checkout host>/…"
  },
  …
}
  • checkoutUrl is the page to send the buyer to. It needs no login and carries no secret.
  • links holds the hosted page for every later step: checkout, release, sellerRefund and buyerRefund. Store the escrow id and read them when you need them; do not build these addresses yourself.
  • parties lists only the SELLER until a buyer is bound at checkout.
  • platformFeeAtomic is the fee, fixed now. It is taken from the seller's side on release.

Two dates, two jobs

fundingDeadline — how long the buyer has to pay

If the escrow is still unfunded when it passes, it becomes EXPIRED within about 30 seconds and you receive escrow.expired. A funding order is capped to it, so even a transaction the buyer signed earlier fails on chain if it is mined late. The checkout shows it as "Pay before". Keep it generous: there is no grace period.

expiresAt — when the buyer may take the money back

From this moment the buyer can refund a funded escrow themselves, whether or not the work is done. A funded escrow never expires on its own. Choose the latest date you would accept the buyer taking their money back. The seller can refund at any time regardless.

  • fundingDeadline must be in the future and no later than expiresAt; otherwise 422 validation_failed names it.
  • Send only expiresAt and the payment window defaults to it. Send neither and an unfunded escrow never expires.
  • fundingDeadline without expiresAt is allowed, but then the buyer can never refund on their own. Do that on purpose.

2. Send the buyer to the checkout

Redirect the buyer to checkoutUrl, or put the Pay with crypto button on your page to open it in a popup. The buyer sees the amount, the fee, the seller and the "Pay before" date before connecting anything. Then they connect a wallet and sign two transactions: a USDC approval and the funding itself. They pay the network fee in ETH.

The wallet that pays becomes the buyer

Without buyerWallet, the buyer can switch wallets until a funding transaction is sent; after that, the wallet that paid is the buyer, and only it can release or self-refund. Say so on your own page too. If you locked the buyer with buyerWallet, the checkout blocks every other account.

Return links prove nothing

After a confirmed payment the checkout offers a link back to successUrl with ?escrow_id=… added; before anything is sent it offers cancelUrl the same way. The buyer clicks them; the checkout never redirects on its own. Anyone can type that address, so show "confirming your payment" there and wait for the webhook.

Anyone with the link can read it

The checkout has no login, so description and the return URLs are visible to whoever holds the link. Put an order id in them, never a session token or personal data. metadata and externalReference are never shown there.

Funding takes block confirmations

The escrow becomes FUNDED only after the transaction is confirmed at the required depth, not when it is sent. Expect seconds to minutes, not milliseconds.

Supported wallets: browser extension wallets, and, where enabled, mobile wallets through a QR code and Coinbase Wallet. Smart-contract wallets are not supported yet.

Retries, double clicks and lost responses

  • Send an Idempotency-Key (8–255 characters) on every create. The same key with the same body returns the original escrow; the same key with a different body is 409 idempotency_key_reuse.
  • One escrow per order attempt. If an unfunded escrow is still open for the order, send the buyer back to its checkout instead of creating another. After a cancelled, expired or refunded one, create a new escrow with a new reference such as order-4471-2.
  • Recover from a lost response. If your process died after the create succeeded, the retry gets 409 because the reference is taken. Look it up with GET /v1/escrows?externalReference=order-4471 rather than failing.
The pattern, in JavaScript
// One escrow per order attempt. A double click must not create a second one.
async function startPayment(order) {
  const existing = await payments.latestForOrder(order.id);
  if (existing) {
    const escrow = await escrowApi.get(existing.escrowId);
    if (['CREATED', 'AWAITING_APPROVAL', 'AWAITING_FUNDING'].includes(escrow.status)) {
      return existing.checkoutUrl;               // still open: send the buyer back to it
    }
    if (!['CANCELLED', 'EXPIRED', 'REFUNDED'].includes(escrow.status)) {
      return null;                               // in flight or paid: do not start another
    }
  }
  const attempt = existing ? existing.attempt + 1 : 1;
  const reference = attempt === 1 ? `order-${order.id}` : `order-${order.id}-${attempt}`;
  try {
    const escrow = await escrowApi.create(bodyFor(order, reference), `order_${order.id}_${attempt}`);
    await payments.insert({ orderId: order.id, attempt, escrowId: escrow.id, checkoutUrl: escrow.checkoutUrl });
    return escrow.checkoutUrl;
  } catch (error) {
    // 409: the reference is taken. An earlier request may have succeeded
    // before your process lost the response. Find it instead of failing.
    if (error.status === 409) {
      const found = await escrowApi.list({ externalReference: reference, limit: 1 });
      if (found.data[0]) return found.data[0].checkoutUrl;
    }
    throw error;
  }
}

Cancel an unpaid escrow

If the order is voided before the buyer pays, call POST /v1/escrows/{id}/cancel with an optional {"reason": "…"} of up to 500 characters. It works only before funding; a funded escrow answers 409 escrow_invalid_state, and is settled by release or refund instead (see release, refunds and disputes).

Escrow statuses

StatusMeaning
CREATEDCreated, waiting for the buyer. Can be cancelled.
AWAITING_APPROVALThe buyer opened the checkout and must first approve USDC. Can still be cancelled.
AWAITING_FUNDINGThe approval is in place; waiting for the funding transaction. Can still be cancelled.
FUNDING_SUBMITTEDA funding transaction was sent and is waiting for confirmations. The buyer is now fixed.
FUNDEDConfirmed on chain. You receive escrow.funded. Mark the order paid.
RELEASE_SUBMITTEDThe buyer signed a release; waiting for confirmations.
RELEASEDThe seller has been paid. Final. escrow.released.
REFUND_SUBMITTEDA refund was signed; waiting for confirmations.
REFUNDEDThe buyer has their money back. Final. escrow.refunded.
DISPUTEDA dispute is open; release and refund are blocked. escrow.disputed.
RESOLUTION_SUBMITTEDThe dispute decision is being executed on chain.
RESOLVEDThe dispute is settled. Final. escrow.resolved, then released or refunded.
CANCELLEDCancelled before funding. Final. escrow.cancelled.
EXPIREDNobody paid before fundingDeadline. Final. escrow.expired.
RECONCILIATION_REQUIREDThe chain and our records disagree (for example a payment mined just before the deadline but seen after). Our staff resolve it; do not mark the order paid.

Converting prices. The API takes USDC amounts only. If you price in another currency, the exchange rate and the currency risk are yours: convert in integer arithmetic and never send a float.

Next