> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axon402.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# x402 Protocol

> How AXON interacts with the x402 payment protocol

[x402](https://www.x402.org/) is an open protocol that lets any HTTP endpoint charge per-request using the `402 Payment Required` status code. AXON governs the payment layer between your agent and x402-capable providers.

## Payment Flow

When your agent encounters a paywall:

```
Agent                    Provider                AXON                 Facilitator
  │                         │                      │                       │
  │── GET /resource ───────►│                      │                       │
  │◄── 402 + PAYMENT-REQ ──│                      │                       │
  │                         │                      │                       │
  │── governed_fetch(url, intent) ────────────────►│                       │
  │                         │  Validate Mandate    │                       │
  │                         │  Check Balance       │                       │
  │                         │  Sign Payment        │                       │
  │◄───────────────────── Response ────────────────│                       │
  │                         │                      │                       │
  │── GET + PAYMENT-SIG ───►│                      │                       │
  │                         │── Verify + Settle ──────────────────────────►│
  │                         │◄── Settlement Proof ────────────────────────│
  │◄── 200 + PAYMENT-RESP ─│                      │                       │
```

## x402 Protocol Headers

| Header | Direction | Purpose |
| :- | :- | :- |
| `PAYMENT-REQUIRED` | Server → Client | Payment terms (amount, asset, recipient, network) |
| `PAYMENT-SIGNATURE` | Client → Server | Signed EIP-3009 authorization from AXON |
| `PAYMENT-RESPONSE` | Server → Client | Settlement proof (transaction hash) |

## Header Compatibility

AXON handles multiple header formats for broad x402 compatibility:

**Challenge read order:**

1. `X-PAYMENT-REQUIREMENTS`
2. `PAYMENT-REQUIRED`
3. `WWW-Authenticate`

**Settlement request headers sent:**

* `X-PAYMENT`
* `PAYMENT-SIGNATURE`

**Receipt read order:**

1. `X-PAYMENT-RESPONSE`
2. `PAYMENT-RESPONSE`

## EIP-3009 Settlement

AXON signs payments using **EIP-3009 TransferWithAuthorization**. This allows gasless USDC transfers where:

1. AXON signs an authorization off-chain
2. The x402 facilitator submits the transaction on-chain
3. USDC transfers from the agent pocket to the provider

## What AXON Adds to x402

| Capability | x402 alone | With AXON |
| :- | :- | :- |
| Payment signing | Agent holds raw key | Agent has mandate-governed pocket |
| Budget controls | None | Per-transaction, daily, monthly caps |
| Provider verification | None | Registry matching + attestation |
| Approval workflows | None | Human-in-the-loop with expiring tokens |
| Audit trail | Transaction hash only | Full decision + receipt + intent logging |
| Emergency controls | None | Freeze wallet/department/organization |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.