Skip to main content

What is x402?

x402 is an open payment protocol built on HTTP. When a server requires payment, it returns an HTTP 402 Payment Required response with a signed payment specification. The client signs a USDC TransferWithAuthorization and retries the request with the signature in the X-PAYMENT header. No API keys. No accounts. No redirects.

How it works with the checkout API

If the order requires a second payment (e.g. shipping adjustment), the poll response returns authorization_required and the agent calls POST /v1/checkout/{id}/authorize — which also triggers a 402 / sign / retry cycle.

Using the SDK

The simplest way to handle x402 is with the official SDK:
The signer must implement the ClientEvmSigner interface:

Manual implementation

If you prefer to implement the payment flow manually:
  1. Make the initial request to /v1/checkout
  2. On a 402 response, parse the payment requirements from the response
  3. Sign a TransferWithAuthorization for USDC on Base (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, chain ID 8453)
  4. Retry the request with the X-PAYMENT header set to the encoded payment payload
The SDK handles expiry, nonce generation, and encoding automatically. Manual implementation is only recommended if you have a specific reason not to use it.