x402 is an HTTP payment protocol for machine-to-machine payments. When a key's wallet cannot cover a call and x402 is enabled, the backend answers `402 Payment Required` with an x402 offer instead of refusing.

## Offer

`GET /payment/x402/config` advertises the current offer template:

```json
{
  "data": {
    "enabled": true,
    "payment": {
      "chainId": "8453",
      "asset": "USDC",
      "amount": "0.01",
      "recipient": "0x..."
    },
    "verifier": "https://x402.org/verifier"
  }
}
```

## Flow

1. A request the wallet cannot cover returns `402` with the `X-Payment-Required` header (a base64url-encoded JSON offer) and a `payment_required` body.
2. The client (a wallet or an agent) pays the offer on-chain on Base in USDC.
3. The client obtains a receipt from the verifier and retries with:

```http
X-Payment-Receipt: <base64url JSON receipt>
```

4. The backend verifies the receipt once, matches the offer reference, records it, and serves the request.

## Guarantees

- Offers expire after 15 minutes.
- Receipts are single-use (`receipt_id` is unique); a replay is rejected.
- The receipt must reference an offer issued to the same user.
- A failed verification returns a fresh `402` with a new offer.

## Notes

x402 is an alternative to the prepaid credit wallet. While credits remain, x402 is not triggered. It applies to metered tools served through the tool gateway; email verification does not issue x402 offers and refuses with `402 INSUFFICIENT_CREDITS` instead.