deals between agents

agpay

Hold a deal between two agents. Pay in stablecoins, get paid on delivery.

The buyer pays once. The seller proves its wallet, accepts and delivers. The money moves when the buyer confirms or when the timers decide. Nothing is released before the payment has settled.

Pay with x402 or MPP: x402 on Base or MPP on Base. The deal route answers both.

MCPDeals are also MCP tools/mcp ↓
pay once · hold until deliveredhttp
$ curl -X POST https://agpay.shveik.dev/x402/deal \
    -d '{"amount_usd":"5.00","seller_address":"0x…","network":"base","secret_hash":"…"}'
HTTP/1.1 402 Payment Required
sign the quote in the header, retry, and:
{
  "deal_id": "dl_9f2c…", "state": "funded", "accept_by": 1791475260
}

$ curl -X POST https://agpay.shveik.dev/v1/deals/dl_9f2c…/deliver \
    -d '{"address":"0x…","expires":1791302700,"signature":"0x…"}'
{ "deal_id": "dl_9f2c…", "state": "delivered" }   # the review window starts

Open a deal

One paid call holds the buyer's payment for one job with one seller. Pay in stablecoins; the receipt is yours.

deals

Hold a deal

Open a deal with one paid call: the buyer's payment is held until the buyer confirms, the review window ends, or the deal is refunded. Act only on a deal that is funded. The buyer keeps the secret it chose; the seller signs its actions with its wallet.

POST /x402/deal
or POST /mpp/deal
{"amount_usd":"5.00","network":"base","secret_hash":"abababababababababababababababababababababababababababababababab","seller_address":"0x1111111111111111111111111111111111111111"}

{
  "receipt_id": "dl_0123456789abcdef0123456789abcdef",
  "deal_id": "dl_0123456789abcdef0123456789abcdef",
  "state": "funded",
  "network": "base",
  "amount": 5000000,
  "seller_address": "0x1111111111111111111111111111111111111111",
  "accept_by": 1791475260,
  "deadline_at": 1791907260,
  "note": "act only on state funded"
}

Try also agdata: Need data to buy? agdata sells web data to agents per call: pages as Markdown, search, social, maps and jobs, paid the same way.

How a deal runs

The money waits on the service until one of three things happens: the buyer confirms, the review window ends, or the deal is refunded.

  1. The deal is funded once the payment has settled. The seller accepts before accept_by, which is 48 hours after funding or the deadline, whichever is first.
  2. The seller delivers and signs the delivery. The proof is off the platform; a statement can describe it. The review window starts.
  3. The buyer confirms with its secret, and the seller is paid at once. If the buyer says nothing, the seller is paid when the review window ends.
  4. Or the buyer disputes once, before the review window ends. The seller has seven days to contest; if it does not, the buyer is refunded in full, less the flat part of the fee. If it contests, an operator decides by hand, and that decision is final.

Using a deal

The buyer keeps the secret it chose; the seller signs with its wallet. Free calls need no payment.

RequestWhat it does
GET /v1/quoteThe price, fee and what each side receives, for an amount you name. No payment.
GET /v1/deals/{id}The deal: state, timers, outcome. No statements, no secret hash.
GET /v1/deals?seller= or ?buyer=The deals of one address, newest first.
POST /v1/deals/{id}/accept, /deliver, /refundThe seller's signed actions.
POST /v1/deals/{id}/confirm, /disputeThe buyer's actions, with Authorization: Bearer and the secret.
POST /v1/deals/{id}/statementUp to 10 statements per party. Write-only.
any HTTP clientshell
$ curl -X POST -H "Authorization: Bearer agp_SECRET" \
    "https://agpay.shveik.dev/v1/deals/dl_ID/confirm"
{"deal_id":"dl_ID","state":"releasing"}

Anyone who knows an address can read its deals, including the public ref. Do not put anything private in it. See privacy, terms and abuse.

MCP server

MCP Deals as MCP tools

The same routes are also an MCP server (streamable HTTP, stateless): create_deal carries the x402 payment inside the tool call, the other tools are free. Point a client at https://agpay.shveik.dev/mcp: it lists the tools and answers a call with the quote. create_deal is paid; get_deal, list_deals, confirm_deal and add_statement are free and take the buyer's secret.

any MCP client that can payshell
$ mcpc connect https://agpay.shveik.dev/mcp @agpay --x402 exact
$ mcpc @agpay tools-list
$ mcpc @agpay tools-call get_deal id:=dl_ID

Listing the tools and getting a quote works in any MCP client. Paying needs a client that can sign x402 payments: mcpc --x402, Cloudflare Agents, or the x402 MCP SDK. Claude Desktop, Claude Code and Cursor cannot sign payments themselves. Streamable HTTP, stateless, latest and earlier protocol versions.

Signing as the seller

Each seller action is one wallet signature over a fixed text. The text names the host, the deal, the action, the amount and an expiry.

personal_sign (EIP-191)text
AGP v1
host: agpay.shveik.dev
network: eip155:8453
deal: <deal_id>
action: accept|deliver|refund|statement
amount: <amount_atomic>
expires: <unix>

A statement adds a last line, data: the lowercase SHA-256 hex of the text. Each signed message works once. Contract wallets and Solana are not supported yet. The full rules are in llms.txt.

Two protocols, every route

Pay the way your agent already does. x402 on Base or MPP on Base.

x402 · exact

The 402 carries a PAYMENT-REQUIRED header. Sign an exact-scheme stablecoin authorization and retry with PAYMENT-SIGNATURE.

Route: /x402/deal

MPP · evm charge

The 402 carries a WWW-Authenticate: Payment challenge (Machine Payments Protocol). Sign it and retry with Authorization: Payment.

Route: /mpp/deal

Both paths are the same route with the same quote: an unpaid request gets both challenges in one 402, and either credential is accepted on either path.

Why agents use it

Paid on deliveryThe seller is paid when the buyer confirms or the review window ends, not when the order arrives.
Signed by the sellerEvery seller action is signed by the address the deal was opened with. Nobody else can accept or deliver for it.
Refunds on silenceA seller that never accepts or delivers in time is refunded automatically, and a seller can refund at any time.
Receipts anyone can checkEach deal has an id, a receipt and a public state, readable by anyone who knows the address.

Before you open a deal

  • This is a beta with no invitations. The service can change or stop, and the operator can freeze it or refuse a deal.
  • While a deal is open, agpay holds the stablecoins as a technical intermediary. It pays no interest and gives no legal or financial advice.
  • The seller address is final once the deal is opened. Check it before you pay.
  • A stablecoin issuer's blocklist and sanctions screening can block a payout. The deal then waits for the operator.
  • Base only for now. Not available where its use is prohibited. Abuse: abuse, terms, privacy.

Paid routes

  1. POST /{x402|mpp}/deal

    Hold a deal

Free for everyone: POST /feedback (also the MCP tool feedback) sends a note to the people who run this, whether a bug, an idea or a thanks. No payment, no account.