x402 Payments

Payments for AI agents and apps, both sides of the transaction

x402 lets software pay for HTTP APIs in stablecoin using the standard 402 Payment Required response. CryptoAPIs runs both halves as a managed, non-custodial service: your keys never leave your side — the client signs every payment locally, and the CryptoAPIs facilitator settles it on-chain.

Give your agent a wallet and let it pay a 402-gated endpoint automatically, or add a per-request paywall to your own API in a few lines. Payments settle in USDC across supported networks, with spending guardrails on the buyer side and on-chain settlement on the merchant side.

x402 Payments
Non-custodial — sign locally
Settles in USDC on-chain
Buyer & merchant SDKs

One protocol,

both sides of the payment

Whether your software needs to pay for an API or charge for one, x402 handles it — non-custodially, with the CryptoAPIs facilitator settling on-chain.

Buy — pay for x402 endpoints

Give an agent or app a managed wallet and let it pay a 402-gated endpoint automatically. Your client authorizes the payment, signs it locally with its own key, and retries — CryptoAPIs never holds the key.

  • Register an agent wallet and authorize payments via one API
  • Sign locally (EIP-712) — non-custodial, no /sign endpoint
  • Per-transaction, daily and monthly spending limits
  • Use the buyer SDK, the x402_pay MCP tool, or the agent plugin

Sell — charge for your API

Add a per-request paywall to your API in a few lines. When an unpaid call arrives, your endpoint answers with a 402 challenge; the CryptoAPIs facilitator verifies the buyer's signed payment and settles it on-chain with its own gas wallet — non-custodially.

  • Drop-in middleware for Express, Hono and Next.js
  • Verify and settle payments on-chain, per request
  • Set your own price per endpoint, paid in USDC
  • Zero-dependency, non-custodial merchant SDK

Pay a 402 in one call

Point the x402_pay MCP tool (or the buyer SDK) at a paid endpoint and it fetches, pays the 402 automatically by signing locally, and returns the paid response.

bash
# Install the buyer MCP server / SDK
npm i -g @cryptoapis-io/mcp-x402-pay

# Set your buyer credentials (kept out of logs)
export CRYPTOAPIS_API_KEY="…"
export X402_WALLET_ID="…"      # wallet record id from POST /wallets
export X402_PRIVATE_KEY="0x…"  # signs locally, never sent

# Now an agent can just: "fetch https://api.example.com/premium"
# → on 402, it authorizes, signs locally, retries, returns the paid data + tx

Start with the x402 docs

Full API reference for the buyer and merchant/facilitator flows, plus SDKs and tooling.

View Docs

What are you up to?

Our powerful blockchain product suite helps businesses and institutions build the ecosystem of tomorrow.

Crypto Wallet
Hardware Wallet
Crypto Exchange
Crypto PSP
Digital Banks
Crypto Lending
Crypto Custody
Crypto Taxes & Accounting

Infrastructure optimized for growth

30+

Networks Supported

25ms

Avg Processing Time

25,000+ rq/s

Enterprise-ready

100+ TB

of Big Data

Frequently Asked Questions

What is x402?

x402 is an open protocol for paying for HTTP APIs with stablecoin, using the standard 402 Payment Required response. CryptoAPIs runs both halves as a managed service: the buyer side (an agent or app pays a 402-gated endpoint) and the facilitator side (verifying and settling those payments on-chain). It lets software pay for individual API requests without accounts or invoices.

Is x402 on CryptoAPIs custodial — do you hold my keys?

No. x402 on CryptoAPIs is fully non-custodial. The buyer holds its own key and signs every payment locally; there is deliberately no /sign endpoint. CryptoAPIs derives and monitors the wallet address and enforces spending policy, but never holds the private key. On the merchant side the facilitator settles with its own gas wallet and can never move funds the buyer did not authorize.

Which blockchains and assets does x402 support?

x402 payments settle in USDC stablecoin. The live networks are published per family by the merchant supported-assets endpoint; a network that is announced but not yet operational shows an empty signer set. EVM networks such as Base are supported, with additional families rolling out.

How does an agent pay for a 402-gated endpoint?

Register an agent wallet, then call the buyer authorize endpoint with the merchant's payment requirements. CryptoAPIs returns the exact payload to sign locally (EIP-712 on EVM). Your client signs it with its own key and retries the request with the signed payment attached. The buyer SDK, the x402_pay MCP tool, and the agent plugin wrap this register → authorize → sign → retry flow for you.

How do I charge for my own API with x402?

Use the CryptoAPIs x402 merchant SDK (Express, Hono or Next.js). When an unpaid request arrives, your endpoint answers with a 402 challenge describing the price; the buyer authorizes and signs it, and the CryptoAPIs facilitator verifies and settles the payment on-chain. You set your own price per endpoint, paid in USDC. The merchant SDK is non-custodial and holds no keys.

Are there spending limits for x402 buyer wallets?

Yes. A buyer wallet supports optional per-transaction, daily and monthly limits, set when you create the wallet or via a later update. A wallet created with no limits receives conservative default safety caps so it is never unlimited by accident. The buyer budget is advisory; the facilitator remains the hard settlement gate.

You might also be interested in