AI agents are increasingly autonomous in their workflows: writing code, fetching data, provisioning resources, and more. To operate fully independently, they need a way to make "micropayments" for services programmatically, in real-time, at minimal cost. Traditional payment rails don't work for micropayments. Solana's sub-cent fees and sub-second finality make this technically and economically viable.
Why is this important?
For example, imagine a developer using an LLM to build an application needs data from a paid API. To fetch some important data, a developer would need to stop their workflow, research APIs, select a provider, create an account, add a payment method, generate an API key, copy the key into their environment, and then resume their workflow. This friction breaks flow state. For AI-assisted workflows, it's a blocker.
Instead, with agentic payments, the agent can make the request, pay for it, and continue with their workflow. No accounts. No API keys. No manual intervention.
The x402 Protocol
Agentic payments need a way for clients and servers to negotiate payment terms over standard web infrastructure without disrupting traditional web interfaces. The micropayment space is still nascent and new tools and standards will likely emerge as the space evolves. The x402 protocol, however, has emerged as an early standard with strong ecosystem support. x402 uses HTTP's 402 "Payment Required" status code—a standard since HTTP/1.1 that only became practical with blockchain settlement.
How it works
The client makes a request, receives a 402 with payment terms, then retries with a signed payment. The server delegates verification and settlement to a facilitator, an optional intermediary that handles the on-chain transaction submission. Once the facilitator confirms settlement, the server returns the requested content. This separation lets API providers accept payments without managing any on-chain infrastructure directly.
x402 Flow Diagram
The protocol is stateless (no sessions or API keys), works with standard HTTP infrastructure, and supports any SPL token the server accepts. Here's a snippet of how to set up an Express server using x402 middleware:
app.use(paymentMiddleware({"GET /costly-data": {accepts: [{scheme: "exact",price: "$0.001",network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",payTo: svmAddress}],description: "Costly data",mimeType: "application/json"}},new x402ResourceServer(facilitatorClient).register("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",new ExactSvmScheme())));app.get("/costly-data", (req, res) => {res.send({report: {data: "costly data"}});});
To learn more on x402, check out our guides:
Introduction to x402
Protocol fundamentals and SDK options for building payment-enabled APIs.
Build with Kora
Implement gasless x402 payments using Kora's signing infrastructure.
x402 Tooling
| SDK | Description |
|---|---|
| Corbits | Solana-first x402 implementation |
| MCPay.tech | Pay-per-request for MCP servers |
| PayAI | x402 facilitator with Solana support |
| x402 GitHub | Reference implementation |
| ACK | Agent Commerce Kit |
| A2A x402 | Google's agent-to-agent payments |
Is this page helpful?