Machine-to-Machine Payments
Abstract
Payment infrastructure for APIs and AI agents. Stop free-tier abuse—charge $0.005+ per call. Integrate in 10 minutes. Providers keep 90-97%. Instant verification (5-10ms), 1000+ RPS. Non-custodial dual-invoice with cryptographic receipts.
Why APIs Can't Charge Per Call
Machines talk to each other all day. But they can't pay each other. Every transaction still needs a human with a credit card.
Free-tier abuse is bleeding you. Users exploit rate limits, create throwaway accounts, and rack up compute costs. You can't enforce payment without building complex billing infrastructure. Every unpaid API call costs you money.
Billing infrastructure is expensive. You built an API. Now you need usage tracking, invoicing, payment processing, dispute resolution, and finance reconciliation. That's 6 months of work.
Subscriptions don't work for AI agents. Agents call 50 different APIs. They can't sign up for 50 subscriptions. They need to pay-per-call, autonomously, without human intervention.
Sub-dollar payments aren't viable. Traditional processors charge 2.9% + $0.30 per transaction. That's a $0.31 fee on a $0.10 API call. Payment rails destroy micropayment economics.
Preimage Research solves this with cryptographic payment authorization (EIP-3009), instant verification, and batch settlement. Pay-before-serve. No billing backend. No custody. Payments from $0.005 with 5-10ms verification.
Example: Translation API
Complete payment flow demonstration. Agent calls API → receives 402 challenge → signs payment → retries with proof → receives translation and cryptographic receipt.
Step 1: Agent calls translation API
POST /translate HTTP/1.1
Host: api.translation-provider.com
Content-Type: application/json
{
"text": "Hello world",
"target_language": "es"
}Step 2: Provider returns 402 Payment Required
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"challenge": {
"provider_wallet": "0xProvider123...",
"platform_wallet": "0xPlatform456...",
"provider_amount_usdc": "0.002",
"platform_amount_usdc": "0.0001",
"payment_hash": "abc123...",
"nonce": "xyz789..."
}
}Provider receives $0.002 (95%). Platform receives $0.0001 (5%). Total: $0.0021.
Step 3: Buyer signs payment proof (5-10ms)
// EIP-3009 signature - NO on-chain transaction yet!
{
"signature": "0xSignedProof...",
"payment_ref": "buyer_payment_123",
"verifies_at": "2025-11-18T10:30:45Z"
}EIP-3009 transferWithAuthorization. Instant (5-10ms). No gas. No on-chain transaction yet.
Step 4: Agent retries with proof
POST /translate HTTP/1.1
Host: api.translation-provider.com
Authorization: Preimage signature="0xSignedProof...",payment_ref="buyer_payment_123"
Content-Type: application/json
{
"text": "Hello world",
"target_language": "es"
}Step 5: Provider returns translation + JWS receipt
HTTP/1.1 200 OK
Content-Type: application/json
X-Preimage-Receipt: eyJhbGc...
{
"translation": "Hola mundo",
"receipt": {
"payment_ref": "buyer_payment_123",
"provider_wallet": "0xProvider123...",
"provider_amount": "0.002",
"platform_amount": "0.0001",
"resp_sha256": "hash_of_response...",
"signature": "JWS_signature...",
"timestamp": "2025-11-18T10:30:46Z"
}
}JWS-signed receipt. Finance can verify independently. Agent proves payment for this exact response.
Step 6: Batch settlement (every 5 minutes)
Payment proof from step 3 batched with 100+ payments. Single multicall transaction settles all. 50-100x gas reduction enables sub-cent payments economically. Key insight: Instant verification (5-10ms) ensures agents don't wait. Batch settlement makes micropayments viable. Dual-invoice means providers receive payment directly—no custody risk.
Finance-Ready Receipts
Every payment generates a cryptographically signed receipt. Finance can verify independently. Disputes are impossible. Rev-share tracking is automatic.
JWS-Signed Receipt
{
"header": {
"alg": "ES256",
"typ": "JWS",
"kid": "provider_signing_key_2025"
},
"payload": {
"payment_ref": "buyer_payment_abc123",
"provider_wallet": "0xProvider123...",
"provider_amount_usdc": "0.002",
"platform_wallet": "0xPlatform456...",
"platform_amount_usdc": "0.0001",
"total_amount_usdc": "0.0021",
"endpoint": "/api/v1/translate",
"method": "POST",
"resp_sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"timestamp": "2025-11-18T10:30:46Z",
"org_id": "org_buyer_acme",
"project_id": "project_translation_agent",
"pricing_tier": "micropayments",
"pricing_percentage": "5.0",
"settlement_batch_id": "batch_20251118_003",
"settlement_status": "pending"
},
"signature": "MEUCIQDxY7Z8L9K...cryptographic_signature..."
}Provider proves delivery: resp_sha256 hashes the exact response. Provider cannot claim they delivered something different.
Buyer proves payment: payment_ref links to cryptographic proof. Provider cannot claim they weren't paid.
Finance verifies independently: JWS signature verifiable with provider's public key. Finance doesn't need to trust Preimage or the buyer.
Rev-share is automatic: org_id and project_id track which agent/team/project made the payment. Attribution is built-in.
Verification Example
import { verifyReceipt } from '@preimage-research/sdk';
// Finance downloads provider's public key from Preimage registry
const providerPublicKey = await fetchProviderKey("0xProvider123...");
// Verify receipt cryptographically
const isValid = verifyReceipt(receipt, providerPublicKey);
if (isValid) {
// This receipt is cryptographically valid
// Provider delivered this exact response
// Buyer paid this exact amount
// Platform took this exact fee
console.log("Receipt verified. Payment confirmed.");
} else {
// Receipt is invalid or tampered with
console.log("Receipt verification FAILED.");
}Traditional payment processors provide transaction IDs. You still reconcile usage logs, match invoices, and trust their reports. Preimage receipts are cryptographic proof. No reconciliation. No disputes. No trust required.
Pricing
4-tier pricing optimized for micropayments. Platform fee: 3-10% (varies by tier). Providers keep 90-97% directly to wallet. Minimum payment: $0.005 (half a cent). No setup fees. No monthly minimums.
Ultra-Micro ($0.005 - $0.009): 10% only. No flat fee. Half-cent payments viable. Example: $0.007 → $0.0007 fee
Micropayments ($0.01 - $0.99): 5% only. No flat fee. True pay-per-use. Example: $0.10 → $0.005 fee
Standard ($1.00 - $9.99): 3% + $0.05. Sweet spot for most API calls. Example: $5.00 → $0.20 fee (4%)
Large ($10.00+): 2.5% + $0.05. Volume discount for high-value. Example: $50.00 → $1.30 fee (2.6%)
Traditional processors (Stripe: 2.9% + $0.30) optimized for subscriptions. Our 4-tier model built for micropayments—making sub-dollar API calls economically viable via batch settlement (50-100x gas reduction). Pay-before-serve eliminates free-tier abuse. Non-custodial—we never hold your funds.
What is Machine-to-Machine Payment Infrastructure?
Machines talk all day—APIs calling APIs, agents coordinating workflows. But they can't actually pay each other. Every transaction needs a human with a credit card or subscription.
Preimage Research delivers instant verification (5-10ms),dual-invoice architecture, and Finance-ready receipts. Micropayments from $0.005. Providers keep 90-97%. Non-custodial.
How Dual-Invoice Architecture Works
Instant Verification
5-10ms local signature verification. 1000+ RPS. Access granted instantly.
Batch Settlement
50-100x gas reduction via multicall contracts. Enables $0.005 minimum.
Non-Custodial
Providers keep 90-97%. Direct wallet payments. We never hold funds.
Finance-Ready Receipts
Cryptographically signed JWS receipts for rev-share, disputes, reconciliation.
HTTP 402 Payment Protocol
HTTP 402 (Payment Required) with instant verification (5-10ms) and batch settlement. Built on Base L2 USDC with batch settlement via USDCBatchSettlement multicall contract. Lightning Network planned for Phase 2.
Challenge Phase
Client requests protected resource. Gateway returns 402 Payment Required with dual-payment requirement:
HTTP/1.1 402 Payment Required
{
"payments": [
{
"recipient": "0xPROVIDER_WALLET",
"amount": "4.90",
"currency": "USDC",
"network": "base"
},
{
"recipient": "0xPLATFORM_WALLET",
"amount": "0.10",
"currency": "USDC",
"network": "base"
}
]
}4-tier pricing: providers keep 90-97% depending on payment size. Both payments go directly to their wallets—non-custodial by design.
Payment Phase
User signs payment authorization with their USDC wallet (MetaMask, Coinbase Wallet, etc.). Returns EIP-3009 signature—cryptographic proof of payment authorization. No blockchain transaction yet (instant, gas-free signing).
Authorization Phase (Instant Verification)
Client retries with signed authorization:
X-PAYMENT: <eip3009_signature>Gateway verifies signatures locally via EIP-712 cryptographic verification (5-10ms). Checks balance and nonce via Coinbase API. Access granted instantly—no waiting for blockchain confirmation. Payment queued for batch settlement.
Batch Settlement Phase
Payments are queued and settled in batches every 60 seconds via multicall smart contract. One blockchain transaction executes 100-1000 signed authorizations, achieving 50-100x gas cost reduction—from ~50% overhead to <1%. This makes micropayments economically viable (minimum $0.005 per call).
Verifiable Receipt Phase
Response includes cryptographically signed receipt:
X-PAYMENT-RESPONSE: {settlement_details}
Preimage-Receipt: jws=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...JWS receipt binds payment amounts, units consumed, content hash, and blockchain transaction IDs (added after batch settlement). Verifiable by Finance via public key at /.well-known/jwks.json.
Note: Currently in private beta with early adopters across AI infrastructure, IoT networks, and data aggregation platforms.
Performance: Instant verification adds 5-10ms latency (300-6000x faster than blockchain settlement). Throughput: 1000+ requests/second. Batch settlement every 60 seconds with ~2s blockchain confirmation (50-100x gas reduction). Micropayments from $0.005 enabled via Base L2 USDC.
Why Preimage Research
Built for per-call API payments and AI agent billing—use cases traditional processors weren't designed for.
| Feature | Preimage Research | Stripe | Metronome | Cloudflare x402 |
|---|---|---|---|---|
| Instant verification (5-10ms) | ✓ | N/A | N/A | ✗ (~2s) |
| Batch settlement (micropayments) | ✓ $0.005 min | ✗ | ✗ | ⚠ Limited |
| Dual-invoice (non-custodial) | ✓ | ✗ | ✗ | ✗ |
| Finance-ready JWS receipts | ✓ | ✗ | ⚠ Logs only | ✗ |
| AI agent payments | ✓ Native | ✗ | ✗ | ⚠ Planned |
| Rev-share proof (receipts) | ✓ Core | ✗ | ⚠ | ✗ |
| Open protocol | ✓ x402 + L402 | ✗ Proprietary | ✗ Proprietary | ⚠ Closed x402 |
| Custody model | Non-custodial | Custodial | Custodial | Custodial |
vs Stripe
Stripe excels at subscriptions and e-commerce. We're built for per-call API payments where sub-dollar transactions are common.
- Billing model: Instant per-call (5-10ms verification) vs subscription/invoice based.
- Micropayments: $0.005 minimum (batch settlement) vs ~$0.50 practical minimum.
- Custody: Non-custodial (direct wallet payments) vs custodial model.
- Receipts: Cryptographically signed JWS for Finance vs transaction logs.
vs Cloudflare x402
Cloudflare pioneered x402 for paid APIs. We extend this with instant verification and batch settlement.
- Verification: 5-10ms local (1000+ RPS) vs ~2s blockchain confirmation.
- Batch settlement: 50-100x gas reduction enables $0.005 minimum.
- Custody: Non-custodial dual-invoice vs custodial server wallets.
- Receipts: JWS-signed with full transaction details for Finance teams.
vs Metronome
Metronome handles complex SaaS metering and billing. We handle instant per-call payments.
- Payment timing: Instant pay-before-serve vs monthly invoices in arrears.
- Setup: Wrap endpoint, set price vs meter configuration and aggregation rules.
- Micropayments: $0.005 minimum vs monthly minimums.
SDK Integration
Integrate machine-to-machine payments into your applications with our client SDKs. Agents handle the entire payment flow autonomously.
from preimage import Agent
# Initialize agent with your wallet credentials
agent = Agent(
wallet_id="your_wallet_id", # From console.preimage-research.ai
api_key="your_api_key",
budget_sats=1000 # Spending limit
)
# Agent autonomously handles L402 flow
response = agent.call(
url="https://api.provider.com/v1/llm",
method="POST",
json={
"model": "gpt-4",
"prompt": "Analyze Bitcoin ETF sentiment"
}
)
# Agent automatically:
# • Receives 402 challenge
# • Evaluates cost vs budget
# • Executes dual-payment (4-tier pricing: providers keep 90-97%)
# • Retries with payment proof
# • Stores Finance-ready receipt
print(response.data)
# {"result": "Sentiment: 78% positive..."}
print(response.receipt.amount_paid)
# 275 sats
print(agent.budget_remaining)
# 725 sats (deducted from your wallet balance)Note: The agent automatically handles budget management, invoice payment, token caching, retry logic, and receipt verification. No manual L402 implementation required.
Installation
pip install preimage-sdkEarly Access
Preimage is currently in private beta. We're accepting applications from teams building AI agent systems, autonomous software, and machine-to-machine payment infrastructure.
Early access participants receive priority API access, dedicated engineering support, and preferential pricing for the first 12 months.
We'll respond within 48 hours. Join the waitlist to secure your position and unlock referral rewards.
Frequently Asked Questions
Common questions about dual-invoice architecture, Finance-ready receipts, non-custodial payments, and machine economy.
Have more questions? Reach out to us at admin@preimage-research.ai.