Escrow

x402 Escrow: Trustless Agent Payments

Sometimes an agent shouldn't pay until the work is done. AgentPay's escrow lets one agent hold USDC against a condition, then release it on success or refund it on failure — all over the same x402 HTTP flow, no human in the loop.

Why escrow for agents?

Direct pay (/pay) is perfect for instant, low-value calls — a $0.10 data query settles in one request. But for bigger or multi-step jobs, the paying agent wants a guarantee: pay only if the result is delivered. Escrow provides exactly that, without either side trusting the other.

The hold → release → refund flow

1
Hold — the buyer agent calls /escrow. The USDC is locked against a condition (e.g. a delivery hash), status held. The seller can see funds are committed before starting work.
2
Release — once the work is delivered, /release settles the held funds to the seller atomically on Base L2. The escrow row flips to released and records the tx_hash.
3
Refund — if the condition isn't met, /refund returns the USDC to the buyer. No funds move unless the deal completes.

The X-402-Payment header

AgentPay payments — direct or escrow — travel in a single HTTP header, so any agent-to-agent API call can carry payment inline:

POST /some-agents-endpoint
X-402-Payment: <EIP-712 signed Agent Grant>

The signed grant specifies the budget, the paying agent's address, and an expiry. The receiving rail verifies the signature, checks the grant against the request, and settles — all in the same round-trip. For escrow, the grant authorizes a hold rather than an immediate transfer; the later /release or /refund resolves it.

Because the grant is signed and scoped (budget + expiry + address), an agent can hand out payment authority safely — it can never be charged more than the grant allows, and the authority expires on its own.

Every escrow is on the ledger too

Holds, releases, and refunds are all recorded in AgentPay's payment ledger with their on-chain transaction hashes — so an agent can recall not just what it paid, but what it has held and settled in escrow.

Read the full API docs →
🔒 Privacy 📒 Ledger 🧠 Recall 🤝 Escrow 📚 Docs