# Paying as an agent

> POST /v0/checkout/{id}/agent — a 402 with what the invoice accepts, then a deposit address. No browser, no UI.

```bash
# 1. Ask what the invoice accepts. No body, no key, no client secret.
curl -s -X POST https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent
# → 402 Payment Required

# 2. Pick an asset from accepts[] and ask for a deposit address.
curl -s -X POST https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \
  -H 'content-type: application/json' \
  -d '{"asset":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501","mode":"transfer","refundTo":"7mQ4pVxLdR2nKjYb9sWcTfA6uZgE3hN8rJpXvB5qDkMt"}'
# → 201, with display.address and display.amountBaseUnits

# 3. Send exactly display.amountBaseUnits to display.address, then poll until invoiceStatus is "paid".
curl -s https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/attempts/pat_9bRm3TyKwE7cNfLv
```

An agent that pays on someone's behalf needs only the invoice ID: the same ID that's in the hosted
page's URL. The invoice, the order behind it and the webhooks are the same as for a customer paying
on the page. The merchant can tell the difference: the attempt, the invoice and every invoice
webhook carry `channel: "agent"`.

## The 402

A call with no body creates nothing. It answers `402 Payment Required` with the invoice and, in
`accepts[]`, every asset it can be paid with, x402-style:

```json
{
  "x402Version": 1,
  "error": "Payment required",
  "resource": "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent",
  "invoice": {
    "id": "inv_3QkR7mVt9zLpXdB2hJn6Yw",
    "status": "open",
    "amount": "49.00",
    "currency": "USD",
    "merchant": "Northwood Supply",
    "description": "Pro plan — 1 month",
    "expiresAt": "2026-11-19T10:30:00.000Z"
  },
  "accepts": [
    {
      "scheme": "intents-deposit",
      "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
      "asset": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501",
      "symbol": "SOL",
      "decimals": 9,
      "chain": "Solana",
      "maxAmountRequired": "331250000",
      "amountInUsd": "49.27",
      "modes": ["wallet", "transfer"],
      "maxTimeoutSeconds": 30
    }
  ],
  "next": {
    "method": "POST",
    "url": "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent",
    "body": { "asset": "one of accepts[].asset", "mode": "transfer", "refundTo": "your address on that asset's chain" },
    "instructions": "Send exactly display.amountBaseUnits of the asset to display.address …"
  }
}
```

`maxAmountRequired` is the all-in amount in base units, and it's **indicative**: the quote is
cached for `maxTimeoutSeconds`. The binding amount comes back with the deposit address, so always
send `display.amountBaseUnits` from step 2, never the 402's number.

`scheme` is `intents-deposit`, not x402's `exact`: you pay a deposit address with an ordinary
transfer, and there's no EIP-3009 authorization to sign.

## Paying

Call it again with a body, as for [`POST …/attempts`](/docs/checkout/headless/):

- `transfer` mode needs `refundTo`, an address on the asset's own chain. If the payment fails,
  it's returned there and nowhere else.
- `wallet` mode needs `payer`, and the response carries `execution.steps` to sign instead of an
  address.

Send exactly `display.amountBaseUnits` to `display.address`, and include `display.memo` when it's
set: without the memo, the payment is lost. Then poll `GET /v0/checkout/{id}/attempts/{attemptId}`
every few seconds until `invoiceStatus` is `paid`. Sending less leaves the attempt `underpaid` with
`amountRemaining` set; top up the same address.

A failed payment arrives at `refundTo` minus network costs.

## Limits

No client secret is needed: the invoice ID is the capability, as it is for the hosted page. The
attempt limits are the same as for every other surface, per invoice and per IP. A new attempt
replaces the invoice's previous one, so an agent and a person shouldn't pay the same invoice at once.

A test-mode invoice (`ik_test_` key) works here too, but has no deposit address. Complete it with
`POST …/attempts/{id}/submit`, which needs the invoice's client secret.

#### Pay an invoice as an agent, with no UI
`POST /v0/checkout/{invoiceId}/agent`
For software that pays on someone's behalf (§12 C3). Call it with **no body** and it answers `402 Payment Required`, x402-style: the invoice, and in `accepts[]` every asset it can be paid with and the indicative all-in amount for each. Nothing is created.

Call it again with `{ "asset", "mode": "transfer", "refundTo" }` and it creates a payment attempt, exactly like `POST …/attempts`, tagged `channel: "agent"`. The response carries the deposit address and the binding amount in `display`. Send exactly that amount, then poll `GET …/attempts/{id}` until `invoiceStatus` is `paid`. The merchant gets the same webhooks as for any other payment.

No client secret is needed: the invoice ID is the capability, as it is for the hosted page (§11.10), and the same per-invoice and per-IP attempt limits apply.
| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \
  -X POST \
  -H 'x-client-secret: $CLIENT_SECRET' \
  -H 'content-type: application/json' \
  -d '{
       "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
       "mode": "wallet",
       "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
       "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
     }'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", {
  method: "POST",
  headers: {
    "x-client-secret": clientSecret,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "mode": "wallet",
    "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
    "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const data = await response.json();
```

```python title="Python"
import httpx

response = httpx.post(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent",
    headers={"x-client-secret": client_secret},
    json={
        "asset": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "mode": "wallet",
        "payer": "0xB47c2Ae95D0f1836cA9E7b240F5dC83a61E09b7D",
        "refundTo": "TRdG7wK2aXpL9oYcB5nVzQ4jMhF3sEuT6b"
    },
)
response.raise_for_status()
data = response.json()
```


| Status | Means |
|---|---|
| `201` | The attempt, with the deposit address (transfer) or the steps (wallet) |
| `402` | Payment required: the invoice and what it accepts |

---

Source: https://intents.fi/docs/checkout/agents · The whole corpus: https://intents.fi/docs/llms-full.txt
