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
CREATEDstraight toPAID. You receiveescrow.paidinstead ofescrow.funded, withsettlementMode,platformFeeAtomicandsellerAmountAtomic. 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_refundedand the order staysPAID.
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:
- Which orders offer “Pay with crypto”. Start with the simplest kind.
- What a crypto payment does to your ledger, receipts and invoices.
- 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 -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" }
}'| Field | Meaning | |
|---|---|---|
| amount | Required | Atomic units as a string. USDC has 6 decimals: "110000000" is 110 USDC. Never a float. |
| currency | Required | "USDC", the only accepted value. |
| sellerWallet | One of two | The seller's wallet address. Trusted exactly as given. |
| sellerWalletId | One of two | A wallet the seller proved they control (swal_…). Preferred; see verified seller wallets. Send this or sellerWallet, never both. |
| buyerWallet | Optional | Leave it out and whichever wallet pays becomes the buyer. Send it only to lock the escrow to one wallet. |
| externalReference | Optional | Your order id, up to 128 characters, unique in your organization. Comes back on every read and webhook. |
| description | Optional | 1–500 characters of plain text. The checkout shows it to the buyer as what they are paying for. |
| successUrl | Optional | Absolute URL, up to 2048 characters, no username or password. https with a live key; a test key also accepts http. |
| cancelUrl | Optional | Same rules as successUrl. |
| fundingDeadline | Optional | RFC 3339. The payment window: unfunded by then, the escrow expires. Defaults to expiresAt. |
| expiresAt | Optional | RFC 3339. The refund lock: from then on the buyer may refund a funded escrow themselves. |
| metadata | Optional | String 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
{
"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>/…"
},
…
}checkoutUrlis the page to send the buyer to. It needs no login and carries no secret.linksholds the hosted page for every later step:checkout,release,sellerRefundandbuyerRefund. Store the escrow id and read them when you need them; do not build these addresses yourself.partieslists only theSELLERuntil a buyer is bound at checkout.platformFeeAtomicis 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.
fundingDeadlinemust be in the future and no later thanexpiresAt; otherwise422 validation_failednames it.- Send only
expiresAtand the payment window defaults to it. Send neither and an unfunded escrow never expires. fundingDeadlinewithoutexpiresAtis 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.
3. Know when it is paid
Mark the order paid when a verified escrow.funded webhook arrives. Before you do, re-read the escrow with GET /v1/escrows/{id} and check that:
- the status is
FUNDEDor a later funded state (RELEASE_SUBMITTED,RELEASED,DISPUTED,RESOLUTION_SUBMITTED,RESOLVED), because a late delivery can arrive after the buyer has already released; amountAtomic,externalReferenceandenvironmentare the ones you stored for this order;- the
BUYERinpartiesis who you expect, if the payer's identity matters to you. It is the wallet that actually paid, as recorded on chain.
Your "waiting for payment" page should poll your server, which asks us. Settle the order through the same routine as the webhook, so whichever arrives first wins and the other does nothing. Poll every 5 seconds or slower: every call with your key draws from one rate limit.
GET /v1/escrows/esc_01M1MD43G9ZRNVVHV25TQ85MCD
Authorization: Bearer esc_test_…
→ { "id": "esc_01M1…", "status": "FUNDED", "parties": [ … ], "fundingEvidence": { … }, … }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 is409 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
409because the reference is taken. Look it up withGET /v1/escrows?externalReference=order-4471rather than failing.
// 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
| Status | Meaning |
|---|---|
| CREATED | Created, waiting for the buyer. Can be cancelled. |
| AWAITING_APPROVAL | The buyer opened the checkout and must first approve USDC. Can still be cancelled. |
| AWAITING_FUNDING | The approval is in place; waiting for the funding transaction. Can still be cancelled. |
| FUNDING_SUBMITTED | A funding transaction was sent and is waiting for confirmations. The buyer is now fixed. |
| FUNDED | Confirmed on chain. You receive escrow.funded. Mark the order paid. |
| RELEASE_SUBMITTED | The buyer signed a release; waiting for confirmations. |
| RELEASED | The seller has been paid. Final. escrow.released. |
| REFUND_SUBMITTED | A refund was signed; waiting for confirmations. |
| REFUNDED | The buyer has their money back. Final. escrow.refunded. |
| DISPUTED | A dispute is open; release and refund are blocked. escrow.disputed. |
| RESOLUTION_SUBMITTED | The dispute decision is being executed on chain. |
| RESOLVED | The dispute is settled. Final. escrow.resolved, then released or refunded. |
| CANCELLED | Cancelled before funding. Final. escrow.cancelled. |
| EXPIRED | Nobody paid before fundingDeadline. Final. escrow.expired. |
| RECONCILIATION_REQUIRED | The 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.