

How we're bringing programmable payments to AI agents using the web's native payment protocol
The AI revolution is here, and millions of agents are being built every day—coding assistants, research tools, medical advisors, financial analysts. But there's a fundamental problem: how do these agents get paid?
Traditional payment systems weren't designed for machine-to-machine commerce. They require human intervention, complex integrations, and assume a browser-based checkout flow. When an AI agent needs to pay another AI agent for a service, the options are limited:
What we need is a payment protocol that's native to HTTP—one that AI agents can understand and use automatically.
HTTP has always had a status code for payments: 402 Payment Required. It was reserved in 1999 but never standardized. Until now.
The x402 protocol finally gives meaning to that status code:
No redirects. No checkout flows. No human intervention. Just HTTP.
Standard x402 handles simple "pay X tokens for this request" flows. But AI agents need more:
That's why we built the nvm:erc4337 scheme—an extension that makes x402 programmable.
When a client calls a protected endpoint, they receive a 402 response with payment requirements:
{
"x402Version": 2,
"error": "Payment required to access resource",
"resource": {
"url": "/api/v1/agents/809184270231.../tasks",
"description": "AI agent task execution",
"mimeType": "application/json"
},
"accepts": [{
"scheme": "nvm:erc4337",
"network": "eip155:84532",
"planId": "44742763076047497640080230236781474129970992727896593861997347135613135571071",
"extra": {
"version": "1",
"agentId": "80918427023170428029540261117198154464497879145267720259488529685089104529015"
}
}],
"extensions": {}
}
The resource object describes what's being protected, accepts lists the payment schemes the server supports, and extensions allows for future protocol additions.
The client generates an x402 access token with delegated permissions:
The server verifies the token, executes the AI workload, and settles payment—all in a single request lifecycle.
For Agent Builders
You can monetize your AI agent in minutes:
import { paymentMiddleware } from '@nevermined-io/payments/express'
app.use(paymentMiddleware(payments, {
'POST /ask': { planId: PLAN_ID, credits: 1 }
}))
One line of code. Your endpoint is now payment-protected.
For Agent Consumers
Your agents can autonomously pay for services:
const { accessToken } = await payments.x402.getX402AccessToken(planId, agentId)
const response = await fetch('https://api.example.com/ask', {
headers: { 'payment-signature': accessToken }
})
No pre-purchase required. No balance checks. The smart account handles everything.
For Enterprises
The x402 protocol enables a new economy where AI agents can:
Imagine an AI research assistant that automatically pays for:
All happening in milliseconds, with cryptographic verification, and complete audit trails.
Ready to add payments to your AI agent?
For step-by-step instructions, check out our 5-minute quickstart.
x402 is our foundation for HTTP-based payments, but we've already extended the same payment infrastructure to other AI protocols:
Whether your agents communicate via HTTP, A2A, or MCP, Nevermined provides unified payment rails.
The future of AI is autonomous agents transacting with each other at machine speed. We're building the financial infrastructure to make it happen.
Nevermined is building financial infrastructure for AI agents. Learn more at nevermined.ai.
For those who want to understand the protocol mechanics:
Step 1: Payment Discovery
GET /api/agent/ask HTTP/1.1
Host: api.example.com
HTTP/1.1 402 Payment Required
payment-required: eyJ4NDAyVmVyc2lvbiI6MiwiYWNjZXB0cyI6Wy4uLl19
The payment-required header is a base64-encoded JSON object specifying:
The client SDK generates an x402 access token containing:
{
"x402Version": 2,
"resource": {
"url": "/api/v1/agents/809184270231.../tasks",
"description": "AI agent task execution",
"mimeType": "application/json"
},
"accepted": {
"scheme": "nvm:erc4337",
"network": "eip155:84532",
"planId": "44742763076047497640080230236781474129970992727896593861997347135613135571071",
"extra": {
"version": "1",
"agentId": "80918427023170428029540261117198154464497879145267720259488529685089104529015"
}
},
"payload": {
"signature": "0x01845ADb2C711129d4f3966735eD98a9F09fC4cE...",
"authorization": {
"from": "0xD4f58B60330bC59cB0A07eE6A1A66ad64244eC8c",
"sessionKeysProvider": "zerodev",
"sessionKeys": [
{ "id": "order", "data": "0x20a13d82dd9ee289..." },
{ "id": "redeem", "data": "0x68e8e34d65914908..." }
]
}
},
"extensions": {}
}
The accepted field echoes the server's payment requirements, confirming which scheme the client chose. The payload contains the cryptographic authorization with session keys that delegate specific permissions to the facilitator.
The server sends the token to the Nevermined Facilitator:
The server returns a settlement receipt in the payment-response header:
{
"success": true,
"creditsRedeemed": 1,
"transactionHash": "0x..."
}
This provides cryptographic proof that payment was processed.
For the complete technical specification, see our x402 Smart Accounts Spec.

Real-time payments, flexible pricing, and outcome-based monetization—all in one platform.