copper
HTTP 402 payments for autonomous agents
Enable any API to accept micropayments using stablecoins. One line of middleware turns endpoints into paid APIs that agents can access seamlessly — no registration required.
Built for AI API providers, model serving endpoints, and agent ecosystems
Problem
APIs today require accounts, API keys, subscriptions, or Stripe setup. This makes it impossible for autonomous agents to pay per request.
Web2 rails block micropayments (<$0.10) due to high fees.
Solution
Make payment part of HTTP itself using HTTP 402.
Agents pay with stablecoins (fast, cheap, stable) and retry requests with payment proof.
💡 Start with our relayer mode (we manage wallets) — then upgrade to full agent wallet mode.
How It Works
Copper enables seamless payment flow between agents and APIs using HTTP 402 status codes. Here's the complete architecture:

The payment flow follows a simple request-response pattern with built-in verification
Returns 402 + price + wallet address + payment request
Agent pays with stablecoin
Agent retries with payment proof
200 OK + API response
402 Payment Requirements
{
"request_id": "req_9a7c3b2f",
"resource": "/api/generate",
"expires_at": "2025-09-27T23:59:59Z",
"accepted_methods": [
{
"type": "stablecoin",
"chain": "solana",
"currency": "USDC",
"pay_to": "SoL_MERCHANT_PUBKEY",
"amount": "0.01",
"encoding": "txid"
}
],
"facilitator": {
"verify_url": "https://verify.copper.exla.ai/settlement"
},
"terms": {
"replay_protection": true,
"single_use": true
}
}Agent retries with: X-PAYMENT: eyJ2IjoxLCJyZXF1ZXN0X2lkIjoi...
One Line Setup
Add payment middleware to any endpoint in seconds
Agent Native
Autonomous agents can pay directly without human setup
Micropayments
Sub-cent payments with minimal transaction fees
Implementation
Server Setup
// Add copper middleware
import { copperMiddleware } from '@copper/middleware'
app.use(copperMiddleware({
merchantWallets: {
solana: {
usdc: 'SoL_MERCHANT_PUBKEY'
},
base: {
usdc: '0xMerchantOnBase'
}
},
pricing: {
'/api/generate': {
price: '0.01',
currency: 'USDC'
}
},
verify: {
via: 'facilitator',
url: 'https://verify.copper.exla.ai'
}
}))Agent Usage
// Agent calls API with guardrails
import { copperFetch } from '@copper/client'
const response = await copperFetch('/api/generate', {
method: 'POST',
body: { prompt: 'sunset' },
wallet: agentWallet,
maxPrice: '0.02',
currency: 'USDC',
preferredChain: 'solana'
})
// Payment handled automatically✨ Magic: Agents automatically handle 402 responses with single-use mandates and replay protection
Facilitator Verification
Verification Request
{
"request_id": "req_9a7c3b2f",
"chain": "solana",
"currency": "USDC",
"txid": "4Jm...xKq",
"pay_to": "SoL_MERCHANT_PUBKEY",
"amount": "0.01"
}Verification Response
{
"valid": true,
"settled_at": "2025-09-27T20:18:12Z",
"confirmations": 1
}Servers verify payments without running full nodes • Supports caching and rate limits
Built on Industry Standards
copper is built on top of Google's Agent Payments Protocol (AP2), the open standard for secure agent-led payments developed with 60+ industry partners.
Multi-Chain Ready
🌐 Multi-Chain: Supports multiple blockchains including Solana, Base, and emerging payment rails like NET Dollar
Security & Safety
Payment Protection
- • Single-use mandates (nonces)
- • Replay attack prevention
- • Double-spend protection
- • Cryptographic verification
- • Time-bound payment requests
Agent Guardrails
- • maxPrice authorization caps
- • Pre-approved spend limits
- • Merchant allowlists
- • Transaction monitoring
- • Multi-chain support
Verification
- • Facilitator verification
- • No full node required
- • Cached payment proofs
- • Rate limit protection
- • Accountability chain
Try Demo
Interactive Demo
See how an agent automatically handles HTTP 402 payments