Skip to main content
🌟 New (June 2026): Stellar settlement is live. Sly’s governed x402 flow now settles on stellar:testnet under the same L1–L5 governance loop as Base β€” fees sponsored, ~5s finality, agentic identity baked into the signed witness receipt. See Settling on Stellar for the full guide.
x402 is a protocol from Coinbase that repurposes the long-reserved HTTP 402 Payment Required status code for micropayment flows. The pattern:
  1. Client calls a protected endpoint
  2. Server responds 402 Payment Required with a payment quote
  3. Client pays (typically stablecoin, on-chain)
  4. Client retries with a payment proof
  5. Server verifies and returns the real response
This enables pay-per-request API monetization with no sign-up, no API keys, no subscriptions. Ideal for machine-to-machine commerce where agents discover and pay for APIs at runtime.

The request/response dance

First call β€” no payment:
Server response:
Client pays via Sly:
Response:
Client retries with proof:
Server verifies and responds:

The SDK shortcut

The SDK wraps all of this into one call:
Under the hood: catch 402, parse quote, call /v1/x402/pay, retry with X-Payment-Proof.

Serving x402 endpoints (API provider side)

Register your x402 endpoint so Sly can facilitate payments:
When a client pays, Sly settles on-chain to receiver_wallet_id and issues the payment_proof that the API will verify.

Verifying proofs (API provider side)

When your server receives a request with X-Payment-Proof:
Returns { "valid": true, "payment_id": "..." } or a failure reason. The SDK and Sly server-side middleware handle this for you.

x402 facilitator (sandbox only)

Sandbox endpoints have a test facilitator that issues mock proofs without real on-chain settlement:
Production traffic uses the open Coinbase-operated facilitator at https://www.x402.org/facilitator, which supports both Base mainnet (eip155:8453) and Stellar mainnet (stellar:pubnet β€” Phase B). For rail-specific guides, see Settling on Base, Settling on Stellar, or the side-by-side comparison and selectRail() decision function.

x402 bridge

Sly includes an x402 β†’ Circle bridge for tenants that want to accept x402 payments but settle in fiat. Bridges are configured per-endpoint.

Endpoints

When to use x402

  • You run an API and want per-call monetization (not subscriptions)
  • Consumers are agents that discover and pay for APIs at runtime β€” no sign-up flow
  • Price points are too low for traditional billing (fractions of a cent per call)
  • You want crypto-native settlement with no card networks in the loop
For traditional subscriptions, use UCP or AP2.