voidly
Guide · updated 2026-05-30

How Do AI Agents Pay Each Other?

No human, no checkout page, no pre-signed contract. Here is the actual mechanism behind one agent paying another — identity, the payment envelope, the 402 handshake, and settlement.

7 min read

Step 1 — Identity: the agent has a keypair

Before an agent can pay, it needs to be someone. In practice that is a cryptographic keypair (commonly Ed25519). The public key derives a stable identifier — often a DID (decentralized identifier) like did:voidly:abc123. The private key never leaves the agent. Every payment the agent makes is signed with it, so the recipient can verify "this really came from that agent" without any central login.

Step 2 — The payment envelope

A payment is a small signed message — an "envelope" — that says: from this DID, to that DID, this amount, this nonce (to prevent replay), valid until this time. The agent signs the canonical bytes of that envelope. A settlement engine verifies the signature, checks the sender has the balance and is within caps, checks the nonce has not been used, and atomically moves the credits.

The whole point is that this is checkable and final. A good settlement engine runs a fixed set of checks (signature, expiry, amount bounds, balance, caps, allowlist, nonce) and either settles all-or-nothing or rejects with a specific reason.

Step 3 — The 402 handshake (paying for an HTTP resource)

The most common pattern is paying for an API call. The agent requests a paid endpoint; the server responds with HTTP 402 Payment Required and a machine-readable body describing what it accepts — the network, the asset (often USDC), the amount, and where to pay. This is the x402 standard.

The agent reads that, constructs the payment, includes proof in a header, and retries. The server verifies the payment and returns the result. To the agent's code it looks like a single fetch() that happened to cost a fraction of a cent.

Step 4 — Settlement: credits or on-chain

Settlement happens one of two ways. Off-chain: a credit ledger moves balances instantly (sub-second) and is periodically reconciled against a real reserve. On-chain: the payment is a stablecoin transfer (e.g. USDC on Base via EIP-3009) settled by the blockchain. Hybrid systems back off-chain credits 1:1 with on-chain reserves, giving you instant settlement plus verifiable backing.

Escrow, streams, and subscriptions

For work that is not a single instant call, the same rails extend: escrow (lock funds until work is accepted), streams (meter usage and settle continuously), and subscriptions (recurring charges). These let agents hire each other for multi-step jobs, not just one-shot API calls.

Where Voidly fits

Voidly Pay implements exactly this: Ed25519-signed envelopes, a nine-check atomic settlement rule, the x402 handshake, escrow/streams/subscriptions, and USDC-backed credits on Base. You can run the full create → claim → fetchWithPay loop in three lines (verified end-to-end) — see /pay/for-builders.

FAQ

Do agents need a crypto wallet to pay each other?

They need a keypair. Whether that maps to an on-chain wallet depends on the system. Off-chain credit ledgers use the keypair for signing but settle in a database; on-chain systems use it as an actual wallet. Hybrid systems (credits backed 1:1 by USDC) give you both.

What stops an agent from spending money it does not have or replaying a payment?

A correct settlement engine enforces a balance check, per-transaction and rolling daily caps, and nonce uniqueness (each payment envelope can settle exactly once). Replays are rejected; over-spends are rejected before any balance moves.

What is the simplest way to add agent payments to my code?

Use an SDK that wraps the envelope signing and the 402 handshake. For example, a three-line flow: create an identity, claim starter credits, then call fetchWithPay(url) which auto-handles any 402. See Voidly Pay's /pay/for-builders.

More on the agentic economy

What Is the Agentic Economy?
The agentic economy is software agents transacting with other software agents — paying for data, tools, and work without a human in the loop. What it is, why it matters in 2026, and where the money is.
What Is x402? HTTP 402 for AI Agents, Explained
x402 revives the dormant HTTP 402 "Payment Required" status code as a standard for machine-to-machine payments. How the handshake works, what a 402 quote looks like, and how agents pay automatically.
Anthropic, the Anthology Fund & AI Payments Infrastructure
How Anthropic and the Anthology Fund relate to the agentic economy and AI-payments infrastructure — the investment thesis, what gets funded, and what builders need to show. An independent explainer.
AI Agent Payment Protocols Compared
A neutral comparison of the main ways AI agents pay for things: x402 (HTTP 402), Google's AP2, Lightning's L402, and stablecoin transfers. Strengths, trade-offs, and when to use each.
How to Add Payments to an MCP Server
Step-by-step: turn your MCP server or API into something AI agents can pay for, using x402 and an agent-payment SDK. Identity, the 402 handshake, pricing, and discovery — with a three-line example.
Anthropic for Startups: Credits, Programs & the Anthology Fund
An independent guide to the ways startups get value from Anthropic in 2026: API credits, the for-startups program, and the Anthology Fund — what each is, what it is not, and how to qualify.
How to Fund an AI Agent Startup in 2026
A practical, hype-free playbook for funding an AI-agent or agent-payments startup in 2026: credits, angels, agent-focused funds like Anthology, and the traction that actually unlocks each.

Independent explainer published by Voidly. Not affiliated with, endorsed by, or funded by any company named. Cite as https://voidly.ai/agentic-economy/how-ai-agents-pay-each-other