Jump to
Ctrl
+
/

x402 Overview

x402 on Crypto APIs

x402 is an open protocol for paying for HTTP resources with stablecoin, using the standard 402 Payment Required response. Crypto APIs runs the buyer and facilitator halves of x402 as a managed, non-custodial service on ai.cryptoapis.io/x402/* — your keys never leave your side. Our implementation follows the x402 v2 specification.

The three players

  • Buyer — an app or AI agent that wants to call a paid endpoint. It holds its own key and signs every payment locally. Crypto APIs derives and monitors the buyer wallet address and enforces spending policy, but never holds the key (there is no /sign endpoint).
  • Merchant — an API that charges per request. It answers an unpaid call with 402 Payment Required and a PaymentRequirements challenge, then hands the buyer's signed payment to a facilitator.
  • Facilitator — verifies the signed payment and settles it on-chain with its own gas wallet. Crypto APIs runs a facilitator; a merchant may also point at any other x402 facilitator.

The flow

  1. The buyer calls the merchant endpoint → 402 Payment Required with a PaymentRequirements challenge.
  2. The buyer calls POST /x402/buyer/authorize → Crypto APIs returns the exact signing payload (an EIP-712 TransferWithAuthorization on EVM, or the equivalent per family).
  3. The buyer signs the payload locally and retries the merchant call with the signed payment.
  4. The merchant calls the facilitator POST /verify then POST /settle; the facilitator settles on-chain and the merchant returns the paid response.

Non-custodial by design

Every payment is signed by the key holder. On EVM the payment is an EIP-3009 transferWithAuthorization meta-transaction — the facilitator pays gas but can never move funds it wasn't authorized for. The same principle holds across every supported family.

Beyond HTTP — paying for MCP tools

x402 defines transports beyond plain HTTP. We implement the MCP transport, so an AI agent can pay for an MCP tool call the same way it pays for an endpoint: the unpaid call returns a payment challenge, the agent pays, and the tool runs. Both halves ship — a merchant can charge for a tool, and an agent can pay for one. See x402 SDKs & Tooling.

Assets & networks

x402 payments settle in USDC (6-decimal stablecoin). The scheme/network pairs we settle are published by the public merchant GET /supported endpoint in its kinds[] array — read that rather than the signers map, which is keyed by CAIP-2 namespace pattern and may legitimately be empty for a family that settles without a facilitator-held signer.

Finding paid resources

The public GET /x402/merchant/discovery/resources endpoint is the x402 v2 §8 discovery catalogue — a paginated list of known paid resources, so buyers and agents can find paid APIs instead of being told about them out of band.

Getting started

See the x402 Buyer and x402 Merchant & Facilitator sections for the endpoint reference.

Was this page helpful?
Yes
No
Powered by

On this page