> ## Documentation Index
> Fetch the complete documentation index at: https://a-identity.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# x402

> Pay-per-action over the HTTP 402 status code, settled in stablecoins.

x402 is an open payment standard from Coinbase and the x402 Foundation. It revives
the HTTP 402 status code so a client can pay for a resource in the same request it
asks for it. No accounts, no API keys by default. A-Identity ships a **real x402
rail**: the server answers an unpaid request with 402 + machine-readable payment
requirements, the client pays USDC on Arc, and the server verifies that payment
on-chain (with replay protection) before serving the resource.

## How One Payment Works

<Steps>
  <Step title="Request">
    An agent requests a paid resource.
  </Step>

  <Step title="402 Payment Required">
    The server answers with status 402 and the payment terms.
  </Step>

  <Step title="Pay And Retry">
    The agent signs a stablecoin transfer, attaches the proof, and sends the request
    again. The server verifies and returns the resource.
  </Step>
</Steps>

Each 402 carries a **single-use, resource-scoped nonce**; the redemption must echo it.
So a payment is bound to the request that quoted it — an unrelated or stockpiled USDC
transfer can't blind-unlock the resource, and every proof is spendable exactly once
(replay protection persisted across restarts).

## Settlement

The x402 standard is asset- and network-agnostic, but A-Identity settles every x402
call in **USDC on Circle Arc** — the same dollar the rest of the platform uses, where
gas is paid in USDC and finality is sub-second. Each call costs a real sub-cent amount
(0.001 USDC in the shipped demo), verified as an on-chain USDC transfer before the
resource is served.

| Property       | Value                 |
| -------------- | --------------------- |
| Standard       | x402 (HTTP 402)       |
| Settlement     | USDC on Circle Arc    |
| Primary rail   | Circle Arc (testnet)  |
| Price per call | 0.001 USDC (sub-cent) |

## Two rails, same standard

A-Identity ships **two** x402 rails and labels which is which:

1. **On-chain, self-verifying** (this page) — each call settles as a real USDC transfer
   on Arc, verified on-chain with replay protection and a request nonce. Provable,
   standalone, no hosted meter.
2. **[Circle Nanopayments](/protocols/nanopayments)** — the same 402 negotiation over
   Circle Gateway's batched scheme: the buyer signs an EIP-3009 authorization off-chain
   (zero gas) and Gateway batches the on-chain settlement, making sub-cent streams
   economical.

<Note>
  We chose the open x402 standard because it is self-verifying — we can **prove**
  settlement on-chain rather than trust a hosted meter — and then added Circle
  Nanopayments as the gasless, batched rail alongside it. Both are live on Arc testnet.
</Note>

## Paid Tools

The `x402-mcp` library puts an x402 paywall in front of a Model Context Protocol
tool. An agent discovers the tool, pays, and calls it, all over HTTP.

<Card title="Build A Paid Tool" icon="code" href="/developers/sdk">
  See the SDK reference for a paid tool in a few lines.
</Card>
