Skip to main content
An escrow deal holds a buyer’s funds in an on-chain contract until you capture them for the seller. Create a deal with POST /dapi/v1/escrow, then drive it with the operator actions in The matrix. Escrow routes are self-scoped and refuse X-Hevn-Account (Acting as a client). A deal moves money between main wallets, and a sub account takes no part in it.
The buyer approves a deal with their key, and the sign-in window does not offer escrow approvals. POST /dapi/v1/escrow with a buyer linked through Sign in with HEVN returns 403 account_not_controlled. Contact HEVN before you build on escrow.

Parties

The parties are different accounts. Sender and receiver are ready clients linked to you through Sign in with HEVN. A referred account does not qualify. HEVN enables escrow for your account in both environments (What HEVN must enable). The deal uses each party’s Base smart wallet address at creation. Its terms are hashed into an on-chain payment record and cannot be changed.

Amounts

capturableAmount is held in the contract. refundableAmount is paid to the seller and still refundable. Choose the next action from availableActions and these two amounts. A draft not approved before approveBy stays draft with an empty availableActions. There is no expired status. Amounts use the money format, for example "100.000000" for USDC. Field meanings are on Read one escrow.

Windows

HEVN converts approveWithin, holdFor and refundableFor into the deadlines in windows when it creates the deal. Each window starts when the previous one ends. void has no window and is available while capturableAmount is positive. Defaults, the duration format and the create refusals are on Open an escrow.

Fees

  • feeBps on the deal is your fee ceiling. capture and charge take a fee up to it, paid to your Base smart wallet. There is no feeReceiver field.
  • refund returns the gross amount from your wallet. The fee is not taken back.
  • HEVN sponsors the gas for each action.

Run an order

1

Create the deal

Call POST /dapi/v1/escrow. It moves no funds and prepares the approval that the buyer signs.
Response 201, Location: /dapi/v1/escrow/esc_5Qb4e17c9d
Read the deal until availableActions is ["authorize", "charge"]. The buyer’s approval is then on chain.
2

Authorize the hold

Prepare authorize with POST /dapi/v1/escrow/{escrowId}/actions, then sign and confirm it as described in Signing. It moves the amount from the buyer’s wallet into the contract. The wallet must hold the token when you confirm.A deal accepts authorize once. An amount below maxAmount leaves the remainder unusable.
Response 200
3

Capture with your fee

Before holdUntil, prepare and confirm capture the same way, with the body {"action": "capture", "amount": "100.00", "feeBps": 250} and the key order-A-1187-capture. You can repeat it up to capturableAmount.The seller receives 97.50 USDC and your wallet receives 2.50. The deal is captured with refundableAmount: "100.000000".

Cancel or refund

Keep the deal’s token in your wallet for refunds. If the wallet cannot cover the amount, refund returns 409 simulation_failed. void, refund and reclaim remain available while your relationship with a client is paused or your profile is suspended.

The matrix

Prepare an operator action with POST /dapi/v1/escrow/{escrowId}/actions and sign the returned payload. Then confirm it at POST /dapi/v1/escrow/{escrowId}/actions/{idempotencyKey}/confirm. The amount and feeBps rules are on Prepare an escrow action. charge is authorize and capture in one on-chain action, with no hold.

Prepare an action

Request: POST /dapi/v1/escrow/esc_5Qb4e17c9d/actions, Idempotency-Key: order-A-1187-capture
Response 201
Confirm with action.idempotencyKey in the path. A replayed key returns the same record (Idempotency-Key).

Confirm an action

Sign the decoded bytes of approval.payload as described in Signing, then send the signature.
Request: POST /dapi/v1/escrow/esc_5Qb4e17c9d/actions/order-A-1187-capture/confirm
400 signature_invalid, 503 bundler_rejected and 503 bundler_unavailable are handled as in Retrying a confirm.

Action in flight

A signing wallet runs one on-chain action at a time across all its deals. While one is signing or submitted, the next prepare or confirm returns 409 action_in_flight with no details. Queue actions per signing wallet and store the id of the deal in flight. Sync that deal before you retry.

Statuses

status records the last transition. Choose the next action from availableActions (Amounts).

Reads

GET /dapi/v1/escrow/{escrowId} returns one deal with its last action. There is no action list. GET /dapi/v1/escrow lists the deals you operate (List the escrows).
Write a repeated status into the path, because the HTTP client’s parameter map holds one value per name. POST /dapi/v1/escrow/{escrowId}/sync reconciles the deal with the chain and returns it with consistent (Reconcile one escrow).

Errors

A closed window, a fee above the ceiling or an amount above the cap returns 400 invalid_request with no details. There is no window_closed or amount_out_of_range code. Read the deal and pick from availableActions. Other codes are in Errors.

Next: Sandbox