> For the complete documentation index, see [llms.txt](https://chaincontext.gitbook.io/help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaincontext.gitbook.io/help-center/monetization/x402-monetization.md).

# x402 Pay-per-call USDC

Charge AI agents per tool call in USDC on Base or Solana. The x402 standard is the 2026 monetization protocol for MCP tools — used by Vercel, Coinbase, Cloudflare Workers, Stellar, and Solana.

> x402 is only available on **public projects** (where the operator ≠ the caller). On private projects, the UI is hidden — you'd be paying yourself.

## How it works

1. Agent calls a priced tool without payment → server responds with `402 Payment Required` and a payment intent
2. Agent signs a USDC `transferWithAuthorization` (EIP-3009) for the requested amount
3. Agent retries with `X-PAYMENT: <base64-encoded JSON>` header
4. Server verifies signature + time window + replay nonce, records the tx, executes the tool
5. Settlement happens asynchronously in a payout worker — platform fee + operator net are sent on-chain

## Setup

1. Open your project → **Revenue** tab
2. Set **x402 recipient wallet** (Base address or Solana address) — where operator USDC lands
3. For each tool you want to monetize: open its edit panel → **Monetization** section → set `price_usdc` (e.g. `0.01`)
4. Deploy — new priced tools enforce x402 on first call

## Platform fee

Platform fee is deducted at settlement time and transferred to ChainContext's treasury wallet:

| Plan       | Platform fee  |
| ---------- | ------------- |
| Builder    | 3%            |
| Studio     | 2%            |
| Enterprise | 0% (override) |

You see gross, platform fee, and net in the Revenue dashboard.

## Supported chains

| Chain         | USDC contract   |
| ------------- | --------------- |
| Base          | `0x8335…0x0291` |
| Base Sepolia  | `0x036C…f7e`    |
| Solana        | `EPjFWdd5Aufq…` |
| Solana Devnet | `4zMMC9srt5…`   |

Settlement latency: \~2s on Base, \~400ms on Solana. Cost: \~$0.02 on Base, \~$0.00025 on Solana.

## Security

* **Replay protection**: the database enforces `UNIQUE(payer_address, nonce)`. A signed payment can only be used once.
* **Time window**: payments have `validAfter` + `validBefore` timestamps. Outside the window → rejected.
* **Signature verification**: shape-validated in the hot path; full EIP-712 recovery happens in the payout worker before the on-chain transfer.

## References

* [x402 standard](https://www.x402.org/)
* [Vercel x402-mcp announcement](https://vercel.com/blog/introducing-x402-mcp-open-protocol-payments-for-mcp-tools)
* [Coinbase x402 docs](https://docs.cdp.coinbase.com/x402/mcp-server)
