AI agents can browse, reason, and call APIs. But they can’t pay safely.
That sounds like a small limitation—but it breaks a surprising number of real-world use cases.
The problem: 402 Payment Required
If you’ve built APIs for agents, you’ve probably run into this:
HTTP/1.1 402 Payment Required
The idea is simple:
- Your API charges per request.
- The client needs to pay before continuing.
This works fine for humans; we see a checkout page and enter a card. It doesn’t work for agents. When an agent hits a paid endpoint:
- It can’t authorize a payment safely.
- It can’t retry after payment.
- The entire workflow just stops.
This makes it nearly impossible to scale pay-per-use APIs, premium data access, or agent-driven SaaS workflows.
What people try (and why it fails)
Current workarounds are either dangerous or inefficient:
1. Giving agents a credit card
The "YOLO" approach. It's high risk because there is no fine-grained spending control and a massive blast radius if the agent's logic loops or it gets prompted to overspend.
2. Prefunded wallets
A common crypto/Web3 workaround. While safer, it suffers from capital inefficiency, poor UX (manual top-ups), and a lack of per-action constraints.
3. Keeping a human in the loop
The safest option, but the least scalable. If every $0.05 transaction requires a human click, you no longer have an autonomous agent; you have a complicated remote-control script.
The missing piece: Authorization vs. Execution
Standards like x402 are starting to fix the execution side (how the money moves). But the real problem is authorization (who said the agent could spend this?).
We need a new primitive: Payment Mandates.
A mandate separates the "how" from the "what." It allows a user to approve a set of constraints:
- Spending limits: "Spend no more than $50 total."
-
Scoped merchants: "Only allowed to pay
api.provider.com." - Expiration: "This permission expires in 24 hours."
How we approached it: Delegare
We built a system that introduces these mandates into the agent's request flow.
Handling 402 automatically
- Agent calls a paid API.
- API returns
402 Payment Required. - The SDK intercepts this, checks the Mandate, and executes the payment.
- The request is retried automatically.
From the agent’s perspective, the "paywall" becomes invisible.
Example (Node.js)
import { Delegare } from '@delegare/sdk';
const delegare = new Delegare({
merchantId: 'm_your_agent_platform_id',
apiKey: process.env.DELEGARE_API_KEY
});
// A signed token representing the user's spending permission
const intentMandate = "eyJhbGciOiJIUzI1Ni...";
const response = await delegare.fetch(
'https://api.premium-data-provider.com/weather',
{ method: 'GET' },
intentMandate
);
const data = await response.json();
console.log(data);
The SDK handles the payment challenges, execution, and retries behind the scenes.
Multi-rail by design
Agents don't care if they are paying with fiat or crypto; they just need the data. Delegare works across:
Fiat via Stripe
- Crypto via USDC/USDT on Base
API payments via x402
Real-world use cases
Once agents can pay safely, the economy of the web changes:
- API Monetization: Charge per request without breaking agent workflows.
- Data Access: Agents can autonomously buy premium datasets for research.
- Autonomous SaaS: Agents can subscribe to services or buy credits as needed.
Where this is going
If agents are going to run complex workflows and operate in real environments, they need a way to transact safely. We believe payment authorization is the "missing layer" of the current agent stack.
We’ve already seen ~1,000 SDK downloads from developers experimenting with this flow before we even officially launched.
🚀 Get Involved
If you're building paid APIs, agent workflows, or MCP integrations, we’d love your feedback.
Try the Sandbox: https://sandbox.delegare.dev
Read the Docs: https://docs.delegare.dev
What are your thoughts on agent-to-agent payments? Drop a comment below!
Top comments (0)