Skip to main content
Use this path when your service has per-request value and you want agents to pay without API keys, signup, or monthly plans.

Job

You want a caller to try the service, see the price, pay when ready, and receive a receipt. The caller may not know what x402 is. Start with the outcome:

Prerequisites

  • A service endpoint with one free demo or preview mode.
  • A paid endpoint that returns HTTP 402 before payment.
  • Exact network, asset, amount, and recipient address for the paid call.
  • Wallet/payment implementation only after the preview and unpaid 402 contract are working.

Verified example

Social Intel API exposes a paid search endpoint and a free demo path. The demo proves the result shape before a caller sees the x402 payment challenge. Free direct demo:
Unpaid HTTP request:
Expected result: HTTP 402 with payment requirements. The verified response included PAYMENT-REQUIRED, accepted Base USDC and Solana USDC, amount 500000 base units, and a payTo address. The free demo and the paid endpoint should use the same input shape, otherwise the demo does not reduce payment risk. Expected unpaid signal:
Redact addresses in bug reports unless the address is already meant to be public.

What just happened

x402 turns price into an HTTP response. The service does not need to ask the user to create an account first. A client can parse the accepted networks, token, amount, destination, and timeout, then decide whether it is allowed to pay. The demo comes before the 402 challenge because the buyer needs evidence before wallet policy matters. A good paid endpoint therefore has two proofs: the free response proves output shape, and the unpaid paid request proves exact payment terms.

The useful 402 body

Your 402 response should include:

Failure branches

Next