ALL ARTICLESJul 2, 2026
Basics

The x402 Protocol and Agent Commerce: When AIs Pay Each Other

HTTP 402 - "Payment Required" - has been a reserved status code since the original HTTP specification in 1991. For 33 years, no one used it. It was a placeholde...

Jul 2, 20263 min readby MorcaLabs

HTTP 402 - "Payment Required" - has been a reserved status code since the original HTTP specification in 1991. For 33 years, no one used it. It was a placeholder for a future where servers could charge for content and clients could pay automatically.

That future arrived in 2025. Coinbase open-sourced the x402 protocol, and for the first time there was a real standard for "machine to machine payments over HTTP."

The problem x402 solves

An AI agent needs to call a premium API - a specialized data feed, an inference service, a tool. In today's world, the agent's operator must: sign up for an account, add a credit card, manage API keys, deal with billing and subscription management. This is fine for human-operated services. It's a bottleneck for autonomous agents.

x402 enables a different model: the API server returns a 402 response with payment details. The client (the agent) pays the required amount directly - using a crypto payment - and retransmits the request with proof of payment. The server verifies the payment and serves the resource. No accounts, no credit cards, no subscription management.

The protocol mechanics

  1. Client sends request to resource server
  2. Server checks: has this client paid? If not, returns HTTP 402 with:
  • Payment amount (e.g., 0.001 USDC)
  • Payment network (e.g., Base, Solana)
  • Recipient address
  • Resource identifier / nonce
  1. Client pays using their stablecoin wallet, attaches payment proof to X-PAYMENT header
  2. Client retransmits request with proof
  3. Server verifies payment proof on-chain, serves resource
  4. Payment proof cached to prevent double-payment on repeat requests

USDFS (USDC Facilitator Service)

Coinbase's reference x402 facilitator handles the payment verification. It monitors supported chains (Base primarily), verifies payment transactions, and returns a signed attestation that the payment occurred. Servers use this attestation rather than querying the chain themselves.

Third-party facilitators - including self-hosted ones - are compatible with the spec. Botanary's dual-protocol facilitator speaks x402 natively, enabling any agent using Botanary for treasury management to pay x402 services without separate wallet infrastructure.

Tempo Machine Payments Protocol (MPP): the streaming alternative

x402 handles per-request payments well. For AI agents that call services continuously - a model that streams inference, a data feed that ticks every second - per-request payments have overhead. Tempo's MPP (Machine Payments Protocol) is an "OAuth for money": the agent authorizes a spending cap once, and payments stream over time within that cap.

Think of it as a pre-authorized credit limit. The agent says "I'm willing to spend up to $10/hour for inference services." The inference server charges within that limit, tracked on-chain. When the cap is reached, the session ends or the agent renews.

Botanary's facilitator speaks both x402 (per-request) and MPP (session-based). The agent doesn't choose - the facilitator detects which protocol the server speaks and adapts. The agent sees one payment API.

The agent economy this enables

When agents can pay other agents, specialized agent services emerge: oracles, inference providers, data curators, compliance checkers, code auditors. Not run by humans for humans - run by automated systems for automated systems, settling in stablecoins per call.

This is one of the most interesting DeFi directions of 2026: not retail users trading tokens, but AI agents paying each other for specialized capabilities, with settlement happening in stablecoins via payment protocols that were written for this exact use case.