Operational
Browse the docs

Docs / HTTP payments with x402

HTTP payments with x402

Pay for an HTTP resource with native USDC. No account, no API key, no gas token. Not the faucet and not write RPC.

Pay from a wallet

  1. Unpaid GET https://poa.net/77/x402/demo returns HTTP 402. The JSON body is the quote (PAYMENT-REQUIRED is that same JSON in Base64; use the body).
  2. Hold native USDC: claim starter funds from the Human Faucet, bridge USDC in from Ethereum, or receive a POA transfer. Operator-invited agents can also use the Agent Gateway faucet for their assigned wallet.
  3. An EOA signs TransferWithAuthorization locally against NativeTransferAuth at 0x2d00000000000000000000000000000000000006 (EIP-712 name USDC, version 2; not Ethereum mainnet USDC 0xa0b86991…, not Permit2, not an ERC-20).
  4. Retry the same URL with a PAYMENT-SIGNATURE header. The demo returns 200 only after the settler tx is included with status 0x1.
curl -sS -D - https://poa.net/77/x402/demo -o /tmp/x402-demo.json

Network is CAIP-2 eip155:77, scheme exact. Flow flags: extra.assetTransferMethod=eip3009, paymentFlow=authorization, kind=native. x402 amount and extra.decimals are 6 (same as explorer balances: 10000 is 0.01 USDC). JSON-RPC eth_getBalance uses 18 decimals on the wire: 1 USDC is 10^18 there, 10^6 here. See Set up your wallet.

Replay. A missing receipt is settlement_pending (402), not success. Worker 502/504 after settle does not mean the payment failed: the settler may already have broadcast. Retry the same PAYMENT-SIGNATURE (or POST https://poa.net/explorer/x402/facilitator/settle with the same payload) rather than re-signing. A replay of (from, nonce) cannot debit twice. While the answer is settlement_pending, keep retrying that same signature: the original authorization may still settle. A 200 means the payment is complete, so do not authorize it again. Sign a fresh authorization only after a definitive payment-failed reason.

PAYMENT-SIGNATURE envelope

PAYMENT-SIGNATURE is Base64 of this envelope, not the EIP-712 digest, and not payload.authorization alone. Copy resource from the 402 body as-is: resource.url is whatever the server put there and may not be the public poa.net URL you requested. Copy the selected accepts[i] object as accepted. authorization.to must equal accepted.payTo, authorization.value must equal accepted.amount. validAfter / validBefore are unix seconds; keep validBefore within accepted.maxTimeoutSeconds of now. nonce is 32 random bytes. Missing resource.url or accepted is invalid_payload in the 402 JSON error field (and in PAYMENT-RESPONSE after a failed settle).

{
  "x402Version": 2,
  "resource": { "url": "<from the 402 body>", "mimeType": "application/json", "description": "…" },
  "accepted": {
    "scheme": "exact",
    "network": "eip155:77",
    "asset": "0x2d00000000000000000000000000000000000006",
    "amount": "10000",
    "payTo": "0x…",
    "maxTimeoutSeconds": 180,
    "extra": {
      "assetTransferMethod": "eip3009",
      "paymentFlow": "authorization",
      "kind": "native",
      "name": "USDC",
      "version": "2",
      "decimals": 6,
      "symbol": "USDC"
    }
  },
  "payload": {
    "signature": "0x…",
    "authorization": {
      "from": "0x…",
      "to": "0x…",
      "value": "10000",
      "validAfter": "0",
      "validBefore": "…",
      "nonce": "0x…"
    }
  }
}

Facilitator

GET  https://poa.net/explorer/x402/facilitator/supported
POST https://poa.net/explorer/x402/facilitator/verify
POST https://poa.net/explorer/x402/facilitator/settle

POST https://poa.net/explorer/x402/facilitator/verify and POST https://poa.net/explorer/x402/facilitator/settle take {"x402Version":2,"paymentPayload":<envelope>,"paymentRequirements":<accepted>}. The facilitator cannot mint. Anyone may submit transferWithAuthorization to 0x2d…06: the signature binds to (payTo) and a one-use nonce, so a front-run cannot redirect funds. The HTTP resource still needs the PAYMENT-SIGNATURE header. validBefore farther than maxTimeoutSeconds from now is rejected at verify/settle. Default timeout is 180 seconds.

Assigned wallets

Assigned wallets sign through POST https://poa.net/explorer/agent/v1/x402/authorize (invite bearer; the key stays with the network’s signer). Then retry the resource with that header.

The AI agents (MCP) does not wrap x402 yet; it has network, balance, faucet, and transfer only.