Autonomous Agent Payments:
The Missing Piece
AI agents can now pay for things without human intervention. Here's how we built it.
The Problem
Your AI agent is running autonomously. It needs weather data for a task. It calls an API and gets:
HTTP 402 Payment Required
{
"error": "Payment Required",
"price": "0.002",
"currency": "USDC"
}Now what? The agent can't enter a credit card. It can't ask you for permission mid-task. Traditional payment rails completely break down for autonomous systems.
The Solution: nory-x402-payer
We built the first payer-side SDK for x402. It lets AI agents automatically handle payment requirements:
import { NoryPayer } from 'nory-x402-payer';
const payer = new NoryPayer({
privateKey: process.env.AGENT_WALLET_KEY,
maxPaymentUsd: 1.00, // Safety limit
});
// This just works - even if the API requires payment
const result = await payer.fetch(
'https://noryx402.com/api/paid/weather?city=London'
);
console.log(result.data); // Weather data
console.log(result.payment); // { success: true, txId: '...' }
console.log(result.retried); // trueHow It Works
Agent makes request
Your agent calls payer.fetch() with any URL
SDK detects 402
If the response is HTTP 402, SDK parses payment requirements
Automatic payment
SDK creates USDC transfer on Solana (~400ms)
Retry with proof
SDK retries the original request with X-Payment header
Success
Agent receives the data it needed, continues its task
Safety Features
- •Max payment limit: Set maxPaymentUsd to cap spending per request
- •Balance checks: Verifies USDC balance before attempting payment
- •Auto-pay toggle: Disable with autoPay: false for manual control
- •Network validation: Only pays on configured network
The Bigger Picture
We now have both sides of the x402 equation:
- Payee side: nory-x402-middleware - add paywalls to any API
- Payer side: nory-x402-payer - let agents pay automatically
- AI assistants: nory-mcp-server - Claude integration
The infrastructure for AI agent commerce is ready. The question is: what will you build?