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

# x402 Payments

> Native HTTP 402 payments in on-chain USDC. Request → 402 with terms → pay → retry → settled.

# x402 Payments

HTTP has had a status code for payments since 1997: **`402 Payment Required`**. Nobody used it because there was no standard way to actually pay.

[x402](https://www.x402.org) makes it real: a resource declares a price; the client pays in USDC on-chain by signing a payment payload; the server verifies and settles it, all inside ordinary HTTP requests. Payzor implements this natively.

## The flow

```mermaid theme={null}
sequenceDiagram
    participant C as Agent / Client
    participant S as Payzor (resource server)
    participant F as x402 facilitator
    C->>S: GET /charges/chg_xxx/x402
    S-->>C: 402 + payment terms (accepts[])
    Note over C: signs USDC payment
    C->>S: GET same URL + X-PAYMENT header
    S->>F: verify(payload)
    S->>F: settle(payload)
    F-->>S: receipt (transaction hash)
    S-->>C: 200 + resource + settlement
```

## What a 402 looks like

```json theme={null}
{
  "x402Version": 1,
  "error": "Paga este cargo firmando USDC y reintentando con X-PAYMENT.",
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "10000",
      "resource": "https://your-payzor-host/charges/chg_xxx/x402",
      "description": "API credits pack",
      "payTo": "0xc80B70D33B1755F7C43B9C1Df48cD089FA7cAB78",
      "asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
      "extra": { "name": "USDC", "version": "2" }
    }
  ]
}
```

`maxAmountRequired` is in USDC base units (6 decimals): `10000` = \$0.01.

## Where you'll find it in Payzor

| Resource                          | What it gates                                                                                    |
| --------------------------------- | ------------------------------------------------------------------------------------------------ |
| `GET /charges/:id/x402`           | Settles an existing merchant charge on-chain (marks it `paid`, method `x402`).                   |
| `GET /shop/products/:sku/content` | Reference implementation of paid digital content; copy this pattern for your own paid resources. |

## Why businesses care

* **No Payzor account needed on the payer side.** Any wallet works.
* **No chargebacks.** Settlement is final.
* **One code path for humans and agents alike**: it's just HTTP.

<Note>
  The demo route settles against the public CDP facilitator on Base Sepolia. For production, configure your own treasury address (`X402_PAY_TO`) and network via environment variables provided by your Payzor operator.
</Note>
