Tempo chain is now live on Chainstack! Get reliable Tempo Testnet RPC endpoints for free.    Learn more
  • Pricing
  • Docs

x402 protocol: Architecture and payment flow for AI Agents

Created Feb 14, 2026 Updated Feb 26, 2026
x402 protocol for AI agents

TL;DR

The x402 protocol formalizes how the HTTP 402 “Payment Required” status code can be used to enable native, programmatic payments across the internet. While HTTP 402 existed for decades as a reserved status code, it lacked a standardized implementation for real-world deployment. x402 defines the request–response structure, authorization format, verification logic, and settlement mechanisms required to make HTTP-level payments functional in production environments.

By embedding stablecoin payment instructions directly into HTTP responses, x402 allows AI agents and applications to discover pricing, authorize transactions, and complete settlement without API keys, subscriptions, or centralized billing accounts. Instead of relying on prepaid credits or manual billing workflows, payment becomes part of the HTTP lifecycle itself.


📖 This article provides a technical breakdown of x402 architecture, payment flow, blockchain settlement, and infrastructure considerations for deploying x402 at scale.

What is x402 Protocol?

At its core, x402 is an open internet-native payment protocol that leverages the HTTP 402 “Payment Required” code. It enables websites and APIs to programmatically request payment for access to data, content, or compute resources, allowing both applications and autonomous AI agents to complete transactions automatically. Payments are typically made in stablecoins and can be executed on any blockchain. By embedding payment directly into the HTTP request–response cycle, x402 eliminates the need for prepaid credits, API keys, know-your-customer (KYC) checks, or manual billing setups.

  • Reduced fees and friction: Direct onchain payments without intermediaries, minimizing costs and eliminating manual setup. Transactions are near-instant and low-cost.
  • Blockchain-agnostic design: Compatible with any blockchain that supports smart contracts, enabling flexible deployment across ecosystems through facilitators.
  • Autonomous Payments: Supports granular, per-request or per-feature pricing through programmable pay-as-you-go flows, no API keys, subscriptions, or middlemen required, stateless.
  • Machine-to-machine transactions: Enables AI agents to autonomously pay for and access services using stablecoins (e.g. USDC), each payment is transparent, verifiable, and stable, ideal for financial accountability in autonomous operations.

The role of HTTP 402 in the x402 Protocol

Historically, the web defined HTTP 402 “Payment Required” as a reserved status code intended for native web monetization. However, no standardized implementation emerged, and traditional payment systems were not designed for real-time, machine-to-machine transactions.

As a result, HTTP 402 remained dormant.

The x402 protocol builds on this reserved status code by defining a machine-readable payment schema, cryptographic authorization model, and settlement workflow. Instead of introducing a new transport layer, x402 extends HTTP itself, embedding payment semantics directly into the request–response cycle.

In practice, a server returns HTTP 402 Payment Required along with structured payment metadata. The client authorizes payment and resubmits the request, allowing access to the protected resource once verification succeeds.

The x402 standard, built by Coinbase, “fixing the internet’s first mistake”, revives and extends HTTP 402 to enable pay-per-request transactions in stablecoins for both users and AI agents which lets any API endpoint request payment without prior account setup. Coinbase launched the new protocol in partnership with AWS (Amazon Web Services), stablecoin issuer Circle, AI company Anthropic and AI-focused proof-of-stake layer-1 blockchain Near Protocol.

Why x402 matters for AI Agents

Artificial intelligence is evolving from content generation into autonomous digital agents capable of executing multi-step workflows. Modern AI agents can interpret objectives, call APIs, execute code, and adjust their actions based on results.

However, most deployed agents face a structural limitation: they cannot transact natively on the internet. Instead, they rely on prepaid API keys, centralized billing systems, or human intervention for every payment.

The x402 protocol addresses this limitation by enabling AI agents to pay programmatically at the HTTP layer. By embedding stablecoin payment logic into the request–response cycle, x402 removes the need for subscriptions or account setup and allows agents to access paid APIs and services autonomously.

This shift transforms AI agents from tool users into economic actors capable of participating in decentralized, machine-to-machine markets.

Why Solana dominates x402 payments

While x402 is blockchain-agnostic, Solana has emerged as the dominant settlement layer, accounting for 50-80% of all x402 transactions:

  • Sub-second finality (~400ms): Payments confirm before the HTTP response
    timeout, enabling true real-time micropayments
  • Ultra-low fees (~$0.00025): Makes $0.01 API calls economically viable—
    something impossible on Ethereum L1
  • High throughput: Handles burst traffic when agents make thousands of
    simultaneous requests
  • Native stablecoin support: USDC-SPL is widely adopted and fast to settle

This makes Solana the practical choice for production x402 deployments where speed and cost matter.

x402 Protocol architecture

x402 enables programmatic payments over HTTP using a structured request–response flow. Instead of managing accounts, API keys, or prepaid balances, payment is embedded directly into the lifecycle of an HTTP request. When a client requests a paid resource, the server responds with payment requirements, the client authorizes payment, and the server verifies and fulfills the request.

  • Initial request (GET /api) : A client (application, backend service, or autonomous AI agent) sends a standard HTTP request (e.g. GET /api/market-data) to a protected endpoint on the resource server.
  • 402 Payment Required returned : If the request does not include valid payment, the server responds with HTTP 402 Payment Required. The response contains structured JSON metadata describing the payment terms in a machine-readable format. Example 402 response payload: { "maxAmountRequired": "0.10", "resource": "/api/market-data", "description": "Access to real-time market data requires payment.", "payTo": "seFkxFkXEY9JGEpCyPfCWTuPZG9WK6ucf95zvKCfsRX", "asset": "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", "network": "solana-devnet" }
    • maxAmountRequired : Maximum amount required (e.g. $0.10)
    • resource : Requested endpoint
    • description (optional) : Payment explanation
    • payTo : Recipient’s Solana wallet address
    • asset : SPL token mint address (e.g. USDC-SPL)
    • network : Blockchain network identifier (e.g. solana-mainnet)
    In standardized implementations, additional fields may include:
    • assetType : e.g. SPL
    • expiresAt : expiration timestamp
    • nonce : replay protection
    • paymentId : unique payment identifier

Field names and values may vary depending on the target blockchain network and token standard, but the overall structure and semantics remain consistent across implementations.

  • Client constructs payload : The client parses the 402 response and generates a cryptographically signed authorization message using its Solana wallet. The signed payload includes:
    • All payment request fields
    • The actual payment amount (≤ maxAmountRequired)
    • Authorization timestamp
    • Wallet signature
    On Solana, signatures follow the native Ed25519 signature scheme. No EIP-712 configuration is required.
  • Request retried with payment : The client resubmits the same GET /api request, now attaching a PAYMENT-SIGNATURE header. In x402 v2, PAYMENT-SIGNATURE contains a Base64-encoded JSON representation of the signed authorization payload, serving as cryptographic proof that the client approved the transaction.
  • Server calls verification endpoint (/verify) : Upon receiving the retried request, the server validates the PAYMENT-SIGNATURE. This may be handled locally or by calling a facilitator’s /verify endpoint. Both PAYMENT-SIGNATURE and PAYMENT-RESPONSE headers must contain valid Base64-encoded JSON strings. Base64 encoding ensures compatibility across HTTP implementations and avoids parsing issues caused by special characters in raw JSON.

Facilitators are optional but simplify verification, multi-network support, and transaction broadcasting. Servers can choose to integrate directly with supported blockchains if they prefer full control over validation and settlement.

  • Verification response returned : If a facilitator is used, it verifies:
    • Signature validity
    • Token standard compliance
    • Network correctness
    • Nonce uniqueness (replay protection)
    • Expiration constraints
    The facilitator then returns a verification result to the server.
  • Server performs requested work: If verification succeeds, the server executes the requested operation (e.g. compute, data retrieval, API logic). If verification fails, the server returns another HTTP 402 Payment Required.
  • Settlement initiated (/settle): After successful verification, the server initiates settlement. This may involve calling a facilitator’s /settle endpoint or preparing a Solana transaction directly. Settlement options may include direct on-chain settlement or batched settlements for multiple micropayments
  • Transaction broadcast to blockchain: If handled by a facilitator, the signed transaction is submitted to the blockchain network (e.g. USDC ) for execution.
  • Transaction confirmation: Solana network processes and confirms the transaction, typically within sub-second finality (~400ms).
  • Settlement confirmation returned: Once confirmed, the facilitator returns a “settled” confirmation response to the server with ultra-low cost (~$0.00025 per transaction), making tiny per-request payments economical.
  • Final response with payment proof (200 OK): The server responds with HTTP 200 OK, including:
  • The requested resource in the response body
  • A PAYMENT-RESPONSE header containing a Base64-encoded JSON settlement record confirming that the SPL token payment was verified and executed on-chain

x402 v2 is out with improved devX, fiat support, and extensions.

x402 in Production

Performance metrics

x402 is designed for high-frequency, low-cost payments, enabling AI agents to transact seamlessly and autonomously. It has already reached meaningful scale across the agent economy, demonstrating sustained real-world usage across multiple networks.

All-Time Statistics

  • Total Transactions: 161.25M
  • Total Volume Settled: $43.55M
  • Total Buyers: 415K+
  • Total Sellers: 83K

Out of which, Solana now accounts for ~50% – 80% of x402 transactions.

Real-World use cases

x402 is the payment engine of the AI‑native, machine‑to‑machine economy. It embeds stablecoin payments directly into HTTP so that users or developers via AI Agents can enable a wide range of monetization models without subscriptions, API key management, or heavy billing infrastructure Below are the core use cases shaping the next wave of decentralized commerce.

Autonomous AI agent payments

Enables AI agents to automatically discover, negotiate, and pay for services, compute, or data without human intervention, turning agents into first‑class economic actors.

  • Google’s Agent Payments Protocol (AP2): Uses x402 to let agents pay one another in stablecoins for completing tasks such as data retrieval, compute jobs, and multi‑step workflows.
  • Cloudflare Agent SDK + MCP: Developers can now build agents that pay via x402 for features exposed through Model Context Protocol (MCP) servers.
  • Stripe x402 on Base: Stripe has launched support for x402 payments on Base, letting developers charge autonomous AI agents directly in USDC for API calls, compute, data access, or HTTP requests via Stripe’s PaymentIntents API.
  • Kite AI: A native Layer‑1 blockchain integrated with x402, designed for autonomous agent payments and settlement, processing billions of inference calls and enabling agents to transact independently.

Micropayments tooling

Third‑party facilitators and SDKs enable broader adoption by abstracting blockchain complexity for developers.

  • PayAI Network: Solana‑first facilitator handling settlement and discovery of agent‑payable services.
  • t54: t54’s x402‑Secure adds identity, verification, and risk management for agent payments, protecting against fraudulent or unwanted transactions by evaluating agent behavior before settlement
  • x402scan: Tools for explorer dashboards, secure payment flows, and developer integration templates across Solana and Base.
  • Awal: An AI‑native, agentic wallet designed specifically for autonomous agents to store, manage, and spend digital assets seamlessly.

Pay‑per‑use API monetization

Let’s APIs charge per request with instant stablecoin settlement, removing subscriptions and API keys altogether.

  • Corbits: Any API endpoint can become a paid resource that agents or apps call and pay for programmatically.
  • CoinGecko x402 APIs: CoinGecko integrated x402 to let autonomous agents pay USDC per request for price and on‑chain data, creating programmatic access for bot‑based arbitrage or analytics.
  • Browserbase: Lets users pay per minute for browser automation sessions using x402, an example of micropayments beyond just APIs.

On-demand content

Creators can monetize articles, images, video, research, datasets, or any digital content with micro‑payments, no accounts or digital wallets needed up front.

  • Numbers Protocol: Numbers Protocol uses x402 for search → pay → license flows that let users instantly pay for verified digital assets and automatically receive on‑chain rights (e.g., Receipt NFTs), an economic model for the AI web.
  • Independent builders have demos of pay‑per‑article or pay‑per‑dataset flows where agents and humans alike trigger micropayments in USDC for access.

Cross‑chain payments

Expands agentic payments beyond a single chain so networks like Ethereum L2s, Polygon, and MultiversX can support machine payments.

  • Sei Network Integration: Sei is one of the first chains to support x402, positioning itself as “TCP/IP for value” in the agentic web and enabling cross‑platform settlement. (see
  • x402 x MultiversX: enabling agentic payments with native tokens and low‑fee settlement.
  • Bridges and payment facilitators expanding support to Polygon, BNB Chain, and more broadening the agentic economy’s rails.

x402 turns every API, service, dataset, and agent interaction into a potential revenue model. It enables AI agents to behave like autonomous economic participants, developers to monetize services per use, and creators to earn instantly for digital assets, all built on a neutral, HTTP‑native payment standard that scales with the next internet.

Building with x402

x402 is supported by a growing suite of developer tooling that makes integration straightforward across agents, APIs, and services. From documentation to SDKs and turnkey Solana templates, builders can quickly integrate pay-per-request monetization into their applications.

Below are key tools supporting the ecosystem.

Core documentation

  • x402 Docs: Official GitBook documentation covering protocol architecture, request–response flows, verification, settlement, and implementation guides.
  • x402 Whitepaper (PDF): Technical specification outlining the protocol architecture, verification flow, and settlement design.
  • GitHub Repository: Issues, proposals, reference implementations, and ongoing protocol development.

Frameworks & SDKs

  • Faremeter: An open-source framework designed specifically for agentic payments, enabling developers to integrate structured pricing and autonomous settlement flows.
  • x402Secure: A security-focused SDK that adds an additional protection layer to x402 transactions, including identity verification, behavioral checks, and fraud mitigation controls.
  • Privy: Wallet infrastructure that allows developers to integrate x402 with embedded Privy wallets, simplifying user and agent onboarding.

Payment & monetization tools

  • PayAI: Infrastructure for selling services directly via x402, abstracting blockchain complexity and simplifying merchant-side integrations.
  • Coinbase Hosted Facilitator (Base): Managed verification and settlement infrastructure with supported network integrations.
  • MCP with x402: Enables developers to payment-gate Model Context Protocol (MCP) servers using x402, allowing AI agents to pay per tool invocation or data request.

Developer resources

  • Solana Templates: Pre-built templates for launching x402-enabled services on Solana, accelerating development with ready-to-deploy configurations

Infrastructure for AI Agents

AI agents require reliable blockchain infrastructure to interact with x402 payment flows. Unlike human users, agents can’t manually retry failed requests or troubleshoot RPC errors—they need predictable, always-on access to verify balances, submit transactions, and confirm settlement.

Chainstack: Enterprise-grade RPC infrastructure purpose-built for AI agent workloads.

For x402 specifically:

  • Solana RPC endpoints are designed to support low-latency verification and settlement workflows for x402 payments
  • 99.99% uptime SLA: Critical for autonomous agents that can’t handle manual
    intervention when RPC endpoints fail
  • Request-based pricing: Aligns with x402’s micropayment model—pay only for what
    agents use, with no compute-unit complexity
  • WebSocket support: Real-time transaction monitoring for agents that need to confirm
    settlement before proceeding with workflows
  • Archive node access: Historical payment verification for compliance, auditing, or
    dispute resolution
  • Global endpoints: Low-latency access from wherever agents are deployed (US, EU,
    APAC)

Traditional RPC providers charge by compute units or have unpredictable rate limits. Chainstack’s transparent, request-based model makes it simple to budget agent infrastructure costs at scale.

Conclusion

The future of AI agents depends not only on intelligence, but on the ability to transact autonomously within decentralized ecosystems. x402 fills this gap by enabling verifiable, programmatic payments at the API layer, allowing agents to pay for data, compute, and services seamlessly.

To operate reliably in production, agents also require dependable blockchain infrastructure. Robust RPC access ensures high-frequency verification and settlement can occur without manual intervention. Infrastructure providers such as Chainstack deliver the uptime, low latency, and predictable performance needed to support agent-native payment flows at scale.

FAQ

What is x402 protocol?

x402 is an open protocol that enables AI agents and applications to pay for APIs, data, and compute resources programmatically using stablecoins over HTTP. It revives the HTTP 402 “Payment Required” status code with a standardized implementation for real-world use.

Why does Solana dominate x402 payments?

Solana accounts for 50-80% of x402 transactions due to its sub-second finality (~400ms), ultra-low fees (~$0.00025 per transaction), high throughput, and native USDC support. These characteristics make it ideal for real-time micropayments at scale.

How do AI agents use x402 to pay for services?

AI agents send HTTP requests to x402-enabled APIs. When payment is required, the server returns a 402 response with payment details. The agent cryptographically signs the payment, resubmits the request, and the server verifies and settles the transaction on-chain before providing access.

What blockchain infrastructure do x402 agents need?

x402 agents need reliable RPC endpoints to verify balances, submit transactions, and confirm settlements. Enterprise-grade infrastructure like Chainstack provides the 99.99% uptime, low latency, and predictable pricing required for production agent workloads.

Can x402 work on blockchains other than Solana?

Yes, x402 is blockchain-agnostic and works on any chain with smart contract support. Implementations exist on Base, MultiversX, Sei, and other networks. However, Solana’s speed and low cost make it the dominant choice for production deployments.

SHARE THIS ARTICLE

Utkarshini Arora

A SheFi Scholar and dedicated Blockchain Researcher. As an educator and content creator, she focuses on creating clear tools and explanations that help developers understand and apply modern technologies.


Customer Stories

tendex

Multi-contract stress-testing to ensure smooth trading infrastructure mainnet operations.

LinkPool

Maintaining unparalleled performance and up time under heavy network strain in securing the Chainlink oracle network.

Trava.Finance

Reliable and high-performance infrastructure across multiple blockchain networks.