Machine-to-Machine Payments: How AI Agents Will Pay for Services

This is Part 1 of our Machine Payments series. We're building open-source infrastructure for AI agent payments and documenting the journey. Follow along as we ship @qbtlabs/x402 and @qbtlabs/mpp.
AI agents are getting remarkably capable. They can write code, analyze data, execute trades, and orchestrate complex workflows. But there's a fundamental gap: agents still can't pay for things on their own.
Consider an AI research agent that needs premium data. Today, it stops and waits for a human to authorize access. A trading agent that needs real-time market data? It's blocked by subscription models designed for humans. The intelligence is autonomous. The payments are not.
That's changing. Two protocols — x402 and MPP — are creating the infrastructure for machines to pay machines, autonomously.
At QBT Labs, we're building the open-source payment infrastructure for this new economy. This post explains what's happening, why it matters, and how you can start building today.
The Problem: Payment Friction Blocks AI Autonomy
Traditional payment systems were designed for humans:
- Account creation with identity verification
- API key management
- Billing relationships and invoicing
- Subscription models with monthly commitments
None of this works for AI agents that need to:
- Access hundreds of different services on-demand
- Pay micro-amounts (fractions of a cent) per API call
- Transact instantly, 24/7
- Operate without human intervention
The result? AI agents are constrained by procurement workflows that take days, while the agent could complete the task in seconds.
McKinsey projects that agentic commerce — where AI agents transact autonomously — will mediate $3-5 trillion of global commerce by 2030. The infrastructure needs to exist now.
HTTP 402: The Status Code That Waited 30 Years
HTTP has always had a status code for payments: 402 Payment Required. It was defined in HTTP/1.1 in 1997 but never used — because there was no practical way to settle micropayments programmatically.
Blockchain changed that. With sub-cent transaction fees and sub-second finality on modern chains, the technical barriers are gone.
x402 (by Coinbase) and MPP (by Tempo & Stripe) both use HTTP 402 to enable programmatic payments:
1. Agent requests a resource 2. Server returns 402 + payment requirements 3. Agent signs payment authorization 4. Agent retries with payment credential 5. Server verifies, settles, returns resource
No accounts. No API keys. No subscriptions. Just pay-per-request.
x402 vs MPP: Two Approaches to the Same Problem
x402 (Coinbase)
x402 is Coinbase's open protocol for programmatic payments. It focuses on blockchain-native settlement:
- EVM chains (Base, Ethereum) via EIP-3009 USDC transfers
- Solana via SPL token transfers
- Facilitator model — settlements routed through a facilitator service
x402 is already supported by Cloudflare, Vercel, AWS, OKX, and dozens of other platforms.
MPP (Machine Payments Protocol)
MPP is co-developed by Tempo and Stripe. It takes a multi-rail approach:
- Tempo — Stablecoin payments with sub-second settlement
- Stripe — Cards, wallets, buy-now-pay-later via Shared Payment Tokens
- Lightning — Bitcoin over the Lightning Network
- No facilitator required — direct settlement
MPP has been submitted to the IETF for standardization as the official HTTP 402 implementation.
Key Differences
| Feature | x402 | MPP |
|---|---|---|
| Facilitator | Required | Eliminated |
| Payment Rails | Blockchain-focused | Multi-rail (crypto + fiat) |
| Sessions | Added in v2 | Native from day 1 |
| Standardization | x402.org | IETF submission |
Sessions are MPP's killer feature for high-frequency use cases. Instead of paying per-request, an agent deposits funds upfront, then issues off-chain vouchers for each request. Settlement happens once at the end — enabling thousands of micropayments with just two on-chain transactions.
What We're Building at QBT Labs
We believe machine payments are foundational infrastructure. We're building two open-source packages:
@qbtlabs/x402
A chain-agnostic x402 implementation with enterprise-grade security:
import { configure, setToolPrices, withX402 } from '@qbtlabs/x402'; // Configure your payment address configure({ evm: { address: '0x...' } }); // Price your tools setToolPrices({ 'get_ticker': 'read', // $0.001 'place_order': 'write', // $0.01 }); // Wrap any handler server.tool('get_ticker', schema, withX402('get_ticker', handler));
What's included:
- ✅ HTTP 402 payment flow
- ✅ EVM + Solana verification
- ✅ Encrypted Vault — AES-256-GCM key storage
- ✅ Process Isolation — Separate signer process (keys never in agent memory)
- ✅ Policy Engine — Spending limits, allowlists, daily caps
- ✅ Audit Logging — Full transaction history
@qbtlabs/mpp (Coming Soon)
Multi-rail payment support following the MPP specification:
- Tempo stablecoins
- Stripe cards + wallets
- Lightning Network
- Session-based streaming payments
Security: The Hard Part
Making payments work is easy. Making them secure is hard.
When an AI agent holds a private key, that key must be protected from:
- Memory dumps
- Log exposure
- Process crashes
- Malicious tool calls
Our x402 implementation addresses this with a three-layer security model:
1. Encrypted Vault
Keys are encrypted at rest using AES-256-GCM with PBKDF2 key derivation. The vault is password-protected and automatically locked after use.
2. Process Isolation
Signing happens in a separate process that communicates via Unix socket. The main agent process never sees the raw private key — only signed payloads.
┌─────────────────┐ ┌─────────────────┐ │ AI Agent │ │ Signer Process │ │ (no keys) │ ───► │ (has keys) │ │ │ ◄─── │ │ └─────────────────┘ └─────────────────┘ │ │ │ Unix Socket │ │ IPC Only │
3. Policy Engine
Before any transaction is signed, it's validated against configurable rules:
- Maximum spend per transaction
- Daily spending caps
- Allowed/blocked recipient addresses
- Allowed chains
// Policy config { "maxSpendPerTx": { "amount": "10", "currency": "USDC" }, "maxSpendPerDay": { "amount": "100", "currency": "USDC" }, "allowedChains": ["base", "8453"], "blockedRecipients": ["0x..."] }
Use Cases: Who Needs This?
MCP Server Operators
Monetize your tools without managing subscriptions. Let any agent pay per-request:
// Your MCP server, now paid server.tool('get_data', schema, withX402('get_data', async (args) => { return await fetchData(args); }));
AI Agent Builders
Give your agents autonomous spending capability with built-in guardrails:
const agent = new TradingAgent({ wallet: vault.getAddress(), policy: { maxPerTx: 1.00, // $1 max per tool call maxPerDay: 50.00, // $50 daily limit } });
API Providers
Add a payment layer to any HTTP endpoint without rebuilding your backend:
// Express middleware app.use('/premium/*', x402Middleware({ price: 0.01, recipient: '0x...' }));
Getting Started Today
For x402
npm install @qbtlabs/x402
import { configure, withX402 } from '@qbtlabs/x402'; configure({ evm: { address: '0xYourWallet' }, }); // Wrap your handler const paidHandler = withX402('my_tool', originalHandler);
GitHub: github.com/QBT-Labs/x402
The Future is Autonomous
We're at an inflection point. AI agents are becoming capable enough to operate autonomously — but they've been blocked at the payment layer.
x402 and MPP remove that barrier. Agents can now discover services, negotiate prices, pay instantly, and continue their workflows. No human intervention required.
At QBT Labs, we're building the open-source infrastructure to make this real. Our x402 and MPP packages are MIT licensed, chain-agnostic, and designed for production.
The question isn't whether machines will pay machines. It's who builds the infrastructure they use.
Resources
- @qbtlabs/x402: github.com/QBT-Labs/x402
- x402 Protocol: x402.org
- MPP Specification: mpp.dev
- OpenMM MCP: github.com/QBT-Labs/OpenMM-MCP
Questions? Reach out at [email protected] or find us on X @QBTLabs.
Related Articles
After the Signature: Receipts, Settlement, and Audit for AI Agent Payments
The companion piece to Beyond the Wallet. That post covered the policy layer in front of the signature; this one covers the operations layer behind it — receipts, settlement, audit logs, and failure handling.
How API Providers Can Monetize AI Agents
Subscriptions and API keys were built for humans, not agents. A practical guide to x402, AMP, and MPP — plus a concrete provider checklist for shipping agent-native pricing in under a week.
Beyond the Wallet: A Builder's Guide to Policy-Controlled Agent Payments with x402
Giving an agent a wallet is the easy part. Production agent payments need budgets, allowlists, signer isolation, receipts, and policy before any signature is produced.