# Pay an invoice over standard x402

> GET /v0/checkout/{invoiceId}/agent. The same resource as `POST …/agent`, for standard x402 clients, which GET a resource first (SPEC-checkout §14). With no payment header it answers `402` with the v2 `PAYMENT-REQUIRED` header (base64 JSON) listing the `exact` requirements: USDC on Base or Solana, to


`GET /v0/checkout/{invoiceId}/agent`

The same resource as `POST …/agent`, for standard x402 clients, which GET a resource first (SPEC-checkout §14). With no payment header it answers `402` with the v2 `PAYMENT-REQUIRED` header (base64 JSON) listing the `exact` requirements: USDC on Base or Solana, to the merchant's address or a deposit address that settles in the merchant's asset. The JSON body is the same as the POST's, with the v1 `exact` entries first.

Retry with `PAYMENT-SIGNATURE` (v2) or `X-PAYMENT` (v1) and the payment is verified and settled through the facilitator: `200` with `PAYMENT-RESPONSE` and a receipt to poll. Add `?payer=<address>` to be offered routed requirements, whose refunds go back to that address. A paid invoice answers with its receipt; an expired or cancelled one with `410`.

## Authentication

The invoice's client secret, in the `x-client-secret` header. It reaches this one invoice's public endpoints and nothing else, and expires with the invoice.

## Parameters

| Parameter | In | Required | Notes |
|---|---|---|---|
| `invoiceId` | path | yes |  |
| `payer` | query | no | The paying wallet. Unlocks routed requirements, whose refunds go back to it |

## Responses

| Status | Means |
|---|---|
| `200` | Paid: the receipt (and `PAYMENT-RESPONSE` when this request paid it) |
| `402` | Payment required: `PAYMENT-REQUIRED` header, and the invoice and what it accepts |
| `410` | The invoice expired or was cancelled |


## Request



```bash title="curl"
curl https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent \
  -H 'x-client-secret: $CLIENT_SECRET'
```

```ts title="TypeScript"
const response = await fetch("https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent", {
  method: "GET",
  headers: {
    "x-client-secret": clientSecret,
  },
});

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.get(
    "https://api.intents.fi/v0/checkout/inv_3QkR7mVt9zLpXdB2hJn6Yw/agent",
    headers={"x-client-secret": client_secret},
)
response.raise_for_status()
data = response.json()
```



## Errors

```json
{ "error": { "code": "INVOICE_EXPIRED", "message": "This invoice has expired" } }
```

Switch on `code`, not on the message: every code has a page under [Error codes](/docs/errors/). Base URL `https://api.intents.fi`; the whole reference is on [one page](/docs/api).

---

Source: https://intents.fi/docs/api/get-checkout-invoiceid-agent · The whole corpus: https://intents.fi/docs/llms-full.txt
