What is x402 Pricing Negotiation?

2 min read Updated

x402 pricing negotiation is the process by which a resource server communicates its accepted payment terms — including amounts, tokens, networks, and schemes — and a client selects the option matching its capabilities and preferences.

WHY IT MATTERS

Unlike traditional payment systems where pricing is displayed on a webpage for humans, x402 pricing negotiation is entirely machine-readable and happens within a single HTTP round-trip.

When a server returns 402 Payment Required, the PAYMENT-REQUIRED header contains an array of PaymentRequirement objects. Each specifies:

  • scheme — the payment logic (e.g. exact for fixed-amount, potentially upto for usage-based, or deferred for batch settlement)
  • network — which blockchain (e.g. base, base-sepolia, ethereum)
  • maxAmountRequired — the price in the token's smallest unit
  • resource — the URL being purchased
  • description — human-readable explanation of what's being purchased
  • extra — scheme-specific metadata

A server might offer the same resource at different prices on different networks (cheaper on L2s), or accept multiple stablecoins. The client evaluates its wallet balances, supported networks, and spending policies to select the optimal option.

This negotiation model mirrors HTTP content negotiation (Accept headers) — the server offers options, the client picks. No accounts, no shopping carts, no checkout pages. Future schemes like upto would enable dynamic pricing where the final cost depends on resources consumed during the request (e.g. tokens generated by an LLM).

HOW POLICYLAYER USES THIS

PolicyLayer evaluates every payment requirement an agent encounters against configured policies. If a server requests payment to an unknown recipient, exceeds per-request limits, or uses a disallowed currency, the payment is blocked before the agent signs anything — even if the agent's own logic would have accepted the terms.

FREQUENTLY ASKED QUESTIONS

Can a server charge different prices on different networks?
Yes. Each PaymentRequirement in the array can specify a different network and amount. A server might charge $0.01 on Base (low gas) and $0.05 on Ethereum mainnet (higher gas overhead), letting clients pick the cheapest option they support.
What happens if the client doesn't support any offered payment method?
The client cannot access the resource. There's no fallback — the client needs at least one matching (scheme, network, token) combination. Well-designed servers offer multiple options to maximise compatibility.
Is dynamic pricing possible with x402?
The exact scheme requires a fixed price per request. The x402 roadmap includes an upto scheme for usage-based pricing — the client authorises up to a maximum amount, and the server settles only what was consumed. Cloudflare's deferred scheme also enables flexible settlement models.

FURTHER READING

Enforce policies on every tool call

Intercept is the open-source MCP proxy that enforces YAML policies on AI agent tool calls. No code changes needed.

npx -y @policylayer/intercept
github.com/policylayer/intercept →
// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.