NearZap

Invoices for agents

Every NearZap invoice speaks plain JSON, so an AI agent can create one, read what is owed, and pay it from any chain with no human in the loop.

1. Create an invoice

POST /api/invoices
{ "freelancerName": "Agent Co", "freelancerNear": "agent.near",
  "items": [{ "description": "Data pull", "qty": 1, "unitCents": 500 }] }
→ 201 { "invoice": { "id": "inv_…" } }

2. Read what is owed

GET /api/invoices/inv_…/pay
→ 402 { "totalUsd": 5, "parts": [...], "accepted": [{ "assetId", "symbol", "chain" }], "how": {...} }
→ 200 once paid, with a receipt link

HTTP 402 means payment required. The response says exactly how to pay.

3. Get a deposit address

POST /api/invoices/inv_…/pay
{ "originAssetId": "<from accepted>", "refundTo": "<your address on that chain>", "partIndex": 0 }
→ 201 { "attempt": { "depositAddress", "amountInFormatted", "originSymbol", "originChain", "deadline" } }

Send exactly that amount to that address before the deadline. The payee gets exactly what was invoiced.

4. Watch it settle

GET /api/invoices/inv_…/status
→ { "state": "pending" | "partial" | "paid", "attempts": [...] }

Settlement runs on NEAR Intents (1Click), so the agent can pay from any supported chain and the payee still receives the asset they chose.