Foundation news

x402 on Stellar: unlocking payments for the new agent economy

Author

Adam Fachler

Publishing date

What x402 is

The web was designed to move information, not money. 

Payments have always been bolted on: signups, API keys, billing systems, subscription management. For human commerce, this works well enough. For AI agents, it doesn't work at all.

When an autonomous agent encounters a paid service—a data API, a compute job, a content resource—the workflow breaks. The agent needs a pre-configured API key, a human to enter billing details, or a subscription someone set up in advance. 

The agent's autonomy usually ends where the payment begins. x402 fixes this. 

The x402 protocol activates the long-dormant HTTP 402 "Payment Required" status code and turns it into an actual payment mechanism. A client — a browser, an app, or an agent — requests a resource. The server responds with a price. The client authorizes a stablecoin payment. The resource is delivered. One HTTP round-trip. No accounts, no subscriptions, no API keys.

Coinbase launched x402 in May 2025 with a simple premise: kill the API key, enable economic reasoning for LLMs, and close the earn/spend loop on the agentic economy. Since then, it has processed millions of payments. The x402 Foundation, co-founded by Coinbase and Cloudflare, now includes Google and Visa. Google has integrated x402 into its Agent Payments Protocol (AP2). In December 2025, x402 V2 added reusable sessions, multi-chain support, and automatic service discovery, features designed for the high-frequency, multi-step workflows that agents require.

Why this matters now

Galaxy Research published a comprehensive analysis of agentic payments in January 2026. Their core finding: x402 and related standards are positioning blockchains as invisible backend infrastructure, not as a separate "crypto economy," but as plumbing that quietly powers mainstream applications.

This finding accurately captures what's happening today. The companies adopting x402 are not just crypto-natives. Cloudflare built x402 into its pay-per-crawl tooling, turning bot mitigation from an access-control problem into a pricing mechanism. Nous Research uses x402 for per-inference billing of its Hermes 4 model. The pattern is the same: software paying for software, automatically, without a human in the loop.

Galaxy estimates that agentic commerce could represent $3–5 trillion in B2C revenue by 2030. But the nearer opportunity is in the less visible layer underneath: API micropayments, data access, compute provisioning—the software-to-software transactions that agents need to function autonomously. This is where x402 operates, and where traditional payment rails like credit cards, subscription billing, invoicing structurally cannot.

How x402 works on Stellar

The flow is straightforward:

The entire cycle completes within 5 seconds. 

The facilitator's role is important to understand: it abstracts blockchain complexity (fees, transaction submission, network selection) while remaining non-custodial. The agent controls what gets paid. The facilitator handles how it settles. This separation is what makes x402 usable by clients that have no blockchain knowledge.

OpenZeppelin is the most widely used open-source smart contract security and infrastructure company in blockchain, with contracts securing over $130B in on-chain assets. The Built on Stellar x402 Facilitator leverages OpenZeppelin's Relayer framework and their open-source Facilitator Plugin.

OpenZepplin also offers audited and battle-tested smart account contracts on Stellar with flexible and programmable context rules, signers, and policies to enforce spending limits, multisig thresholds, and scoped permissions for x402 resources. This provides the budget controls and guardrails that agentic payments require. SDF brought OpenZeppelin into the x402 ecosystem—a distinct contribution to the protocol.

For API providers, setup is minimal: add x402 middleware to your server and specify a Stellar address to receive payments. No wallet management. No blockchain expertise. No billing system.

Get started: add x402 to your API

Here’s what it looks like to protect an Express API endpoint with x402 on Stellar:

// Server: protect an endpoint with x402
import { paymentMiddleware } from '@x402/express';


app.use(paymentMiddleware({
  "GET /weather": {
   accepts: [
     {
       scheme: "exact",
       price: "$0.001",
       network: "stellar:pubnet",
       payTo: "G...YOUR_STELLAR_ADDRESS",
     },
   ],
   description: "Weather report",
 },


}));

That’s it. Any request to /weather now requires a stablecoin micropayment on Stellar. The facilitator handles verification and settlement. The merchant receives payment directly.

Why Stellar

Stellar was purpose-built for payments. For a decade, the network has prioritized the properties that a settlement layer for x402 specifically requires:

Settlement speed. x402 payments are synchronous HTTP requests. The settlement layer needs to resolve within the same request cycle. Stellar settles in under 5 seconds.

Fee-free transactions. The Built on Stellar x402 Facilitator handles verification and settlement and covers network fees, meaning one fewer barrier between users and the resource they're paying for.

Transaction cost. Micropayments only work if the transaction fee doesn't exceed the payment itself. Stellar fees are approximately $0.00001. On many other networks, the fee would exceed the payment.

Stablecoin infrastructure. Stellar has native support for USDC, PYUSD, and USDY. Stablecoins are first-class citizens on the network, not bridged or wrapped assets.

Reliability. For autonomous agents operating 24/7, network downtime means broken workflows and lost transactions. Stellar has maintained 99.99% uptime since launch — zero extended outages across 20.6 billion total network operations.

Programmability. Soroban, Stellar's smart contract platform, enables programmable payment policies — spending limits, approval rules, compliance controls. For enterprises deploying agents with budgets, this is how you set guardrails without removing autonomy.

Real-world connectivity. Stellar's off-ramp network—MoneyGram across 170+ countries and 470,000 locations, Airtm + Bridge in 150+ countries—means agent initiated payments can connect to the real economy. An agent paying for a service on Stellar can trigger a payout that arrives as local currency.

What's ahead

x402 on Stellar today handles the settlement layer — fast, cheap, reliable stablecoin transfers. The next phase is agent-native tooling:

  • MCP integration: The x402-MCP server will let AI agents discover paid resources, authorize payments via smart wallets, and chain multiple paid API calls within user-defined spending policies. This is in active development and aligns with Coinbase's public x402 roadmap.
  • Embedded smart wallets: OpenZeppelin's smart account contracts on Stellar support spending limits and programmable policies. Combined with wallet providers like Crossmint, this enables agents to operate within defined budgets and rules.
  • Multi-chain cost optimization: Because x402 V2 supports multiple settlement networks, clients can select the optimal chain for each payment based on cost, finality speed, or other criteria. Stellar's near-zero fees make it the natural default for micropayments.

The settlement layer is live. The agent tooling is being built. If you're building APIs, AI agents, or digital products, this is the time to start experimenting.

Resources

Join the conversation:

#x402 channel on Stellar Discord