AI Workflow
Generative AI
8 min reading

AP2 vs x402: How Do AI Agents Pay?

A payment card next to two cards, AP2 for permission and x402 for payment, with a VS badge: how do AI agents pay?

Summarize this article with:

summary

AI agents can now find a product or an API and pay for it themselves. Two open protocols make that possible: Google's AP2 for permission, and x402 for the payment. Here is how they differ, and how they work together.

Ask an AI agent to "buy this dataset for $2" and two questions come up before any money moves. Did a person really authorize this purchase, at this price? And how does the agent actually pay a website or an API that has never seen it before?

Two open protocols answer them. AP2, the Agent Payments Protocol started by Google, answers the first: it produces signed, verifiable evidence of what the user approved. x402, created by Coinbase, answers the second: it lets a client pay for a resource over HTTP, with a 402 response and a paid retry, usually in stablecoins. They address different layers: you can use either one alone, or combine them.

This article explains how each one works, which one fits your case, where they meet, the other protocols you will hear about, and how to keep an agent's spending on AI calls under control.

AP2 and x402 at a glance

AP2x402
Question it answersDid the user approve this purchase?How does the client pay for this request?
Started byGoogle, September 2025Coinbase, 2025
Governed byFIDO Alliance, since April 2026x402 Foundation, Linux Foundation, since July 2026
Core objectSigned mandates (checkout and payment)HTTP 402 response, then a signed payment header
Payment methodsPayment-agnostic: cards, bank transfers, stablecoinsMainly stablecoins, on EVM chains, Solana and others
Typical useA shopping agent buying from a merchant for a personAn agent or app paying per call for an API or a piece of content
Protocol feeNone defined by the protocol, payment fees applyNone defined by the protocol, network and facilitator fees may apply
AP2 is about permission, x402 is about payment. One proves who said yes, the other moves the money.

Which one do you need?

  • You run a shop and want agents to buy from you: start with AP2, because it carries evidence of user approval and works with the cards your customers already use.
  • You sell an API, data or content per request: x402 lets agents pay per call without a prepaid account, which suits small amounts that card fees make uneconomical.
  • You build agents that spend money: use both when you need portable proof of the user's limits and an endpoint asks for an x402 payment. An agent can also pay with x402 under your own internal rules, without AP2.
  • You build agents that call AI models: neither protocol is required. What you need is a limit on what each agent can spend, which the last section covers.

Why agents need new payment protocols

Online payments assume that a person clicks "buy". Card networks, fraud checks and dispute rules are built around that moment. When an agent places the order, the merchant, the bank and the user all lose that signal. Google's AP2 announcement puts it as three questions: authorization (did the user give the agent authority for this purchase?), authenticity (does the request reflect what the user really wants?) and accountability (who is responsible if something goes wrong?).

APIs have a different problem. To pay for an API today, someone signs up, adds a card, creates a key and buys credits. That works for a developer. It works less well for an agent that finds a useful paid endpoint in the middle of a task and needs one call, once, for a few cents.

AP2: signed proof of what the user approved

AP2 was announced by Google on 16 September 2025 with more than 60 organizations, including Mastercard, American Express, PayPal, Adyen, Coinbase and Revolut. It is designed as an extension of the Agent2Agent (A2A) protocol and of MCP, and it is payment-agnostic: the same flow can end in a card payment, a real-time bank transfer or a stablecoin transfer.

Its core object is the mandate: a cryptographically signed record of what was approved, which merchants and payment providers can verify. The first version described an Intent Mandate and a Cart Mandate. The current v0.2 specification uses two mandate types, a Checkout Mandate for the purchase itself and a Payment Mandate for the payment, each in an "open" form (the limits a user sets) and a "closed" form (the exact purchase).

Human present, human not present

AP2 covers two situations:

  • Human present: the agent builds the cart, and the user reviews and signs the final checkout and payment.
  • Human not present: the user signs open mandates in advance, for example "buy these concert tickets if they go on sale under $150". When the conditions are met, the agent completes the purchase within those limits. If the merchant cannot satisfy a constraint, the flow can fall back to asking the user.

Google described the delegated case at launch. AP2 v0.2, published when Google handed the protocol to the FIDO Alliance in April 2026 together with Mastercard's Verifiable Intent framework, added support for human-not-present payments to the specification. FIDO, the body behind passkeys, now develops it as an open standard. The result is an audit trail from the user's request to the payment. It is evidence under a trust model, not a guarantee: it does not prove on its own that the user's device or the agent was not compromised.

x402: payment over HTTP

HTTP has had a "402 Payment Required" status code since the 1990s, and the current HTTP standard still reserves it for future use. x402 gives it a job. The x402 specification defines the headers and the steps:

STEP 1
Request
The agent calls a paid endpoint, without a prepaid account or API key.
STEP 2
402 Payment Required
The server answers with its price, network and address in a PAYMENT-REQUIRED header.
STEP 3
Signed payment
The agent retries the same request with a PAYMENT-SIGNATURE header.
STEP 4
200 OK
A facilitator verifies and settles on-chain, and the server returns the resource with a receipt.
One extra HTTP round trip. No sign-up, no stored card, no API key to manage in the basic flow.

The server can check the payment itself or use a facilitator, an optional service that checks the payment on /verify and submits it to the chain on /settle. The server returns the result in a PAYMENT-RESPONSE header. The specification defines several payment schemes: exact for a fixed price, and upto, where the client authorizes a maximum and the seller charges the actual usage, which suits metered services such as AI inference.

x402.org describes the protocol as blockchain-agnostic, with support for EVM chains and Solana, and with no protocol fee for the buyer or the seller. Network fees apply, and a facilitator or wallet provider may charge its own. Coinbase reports more than 100 million x402 payments across Base and Solana. Since July 2026 the protocol is stewarded by the x402 Foundation at the Linux Foundation, which launched with 40 members, among them Google, Visa, Mastercard, Stripe, Cloudflare, AWS, Shopify and Coinbase.

How AP2 and x402 work together

The two protocols were designed to compose. When Google announced AP2, it also released the A2A x402 extension with Coinbase, the Ethereum Foundation and MetaMask, so that an AP2 flow can settle in stablecoins through x402.

Take the $2 dataset again, as an illustration. The user signs an open mandate: "datasets of this kind, up to $5, this week". The seller's endpoint answers with a 402 and a $2 price. The agent checks the price against the mandate, closes it for this purchase, and pays with x402. The seller receives both the payment and the signed authorization it refers to. How the two are linked is defined by the extension, so check its specification before you build on it.

The other agent commerce protocols you will hear about

  • ACP, the Agentic Commerce Protocol: an open standard co-developed by Stripe and OpenAI, released in September 2025 with checkout in ChatGPT. It covers the checkout between a buyer's agent and a business, with payment credentials passed as a secure token.
  • UCP, Google's Universal Commerce Protocol: a broader standard for discovery and checkout across AI Mode in Search and the Gemini app, which Google describes as compatible with AP2, A2A and MCP.
  • Card networks: Visa and Mastercard run their own agent programs on top of existing card rails, and Mastercard's Verifiable Intent now sits with AP2 at the FIDO Alliance.

In short, ACP and UCP are about the shopping and checkout experience, AP2 about authorization, and x402 about paying for a request.

What is still missing

Both protocols are young, and their numbers come from their own ecosystems. Coinbase's count covers the payments it processed, not the whole market, and stablecoin payments still require a wallet on each side. AP2's human-not-present flow has been in the specification since April 2026, and we have not found public figures on its use at card-network scale.

Several questions remain open for anyone building on them:

  • Agent identity: which agent is acting, and for whom, is only partly covered by mandates.
  • Keys and wallets: an agent that holds a wallet key is a new target, so spending caps and key storage matter as much as the protocol.
  • Retries and double payment: a client that retries after a timeout must not pay twice, which needs idempotent handling on both sides.
  • Refunds and disputes: they work differently on a blockchain than on a card network.
  • Regulation: rules on stablecoin payments vary by country, which matters for any European company that wants to accept them.

Payment protocols don't cap your agent's AI spending

AP2 and x402 deal with purchases and payments. They do not limit the model calls an agent makes along the way: an agent can stay inside its shopping mandate and still burn through hundreds of dollars of LLM calls in a loop. That is a separate problem, and you can solve it today with the key each agent uses.

At Eden AI, one API key gives access to about 1,000 models from more than 80 providers, and every response returns its cost. You can give each agent its own key with a budget that resets every day, week or month, an email alert threshold, an expiry date, and tags that split usage per agent in monitoring. When the budget reaches $0, the key stops working, whatever the agent decides to do, and a runaway agent can only spend its own allowance. The Custom API Keys documentation covers every field.

import os
import requests

# Management key (Dashboard > Account > Management Keys). Never give it to the agent.
headers = {"Authorization": f"Bearer {os.environ['EDENAI_MANAGEMENT_KEY']}"}

response = requests.post(
    "https://api.edenai.run/v3/manage/keys/",
    headers=headers,
    json={
        "name": "research-agent",
        "balance_reset_period": "daily",      # reset at midnight, Paris time
        "balance_reset_amount": "5.00",       # starts at $5, back to $5 each day
        "budget_alert_percent": 80,           # email once $4 of the $5 is spent
        "expire_time": "2027-01-31T00:00:00Z",
        "default_tags": {"agent": "research"},
    },
    timeout=30,
)
response.raise_for_status()
key = response.json()

print(key["name"], key["masked"], key["balance"])
agent_key = key["secret"]  # shown once: store it in your secret manager

It is the same idea as an AP2 mandate, applied to AI usage: a limit set in advance by a person, enforced outside the agent, with a record of every call. Start with one agent: create its key, set a small budget, and watch what happens when the budget runs out.

Permission and payment, two separate layers

AP2 is about permission and x402 is about payment. AP2 makes a purchase verifiable, x402 makes a payment possible over plain HTTP, and together they let an agent buy something without a person clicking a button. Both now sit with neutral standards bodies, the FIDO Alliance and the Linux Foundation, so no single vendor controls where they go next.

If your agents already spend money on AI calls, you don't need to wait for either protocol. Read the Custom API Keys guide, then create a free Eden AI account and give your first agent its own budgeted key.

FAQ

What is AP2?

AP2, the Agent Payments Protocol, is an open protocol started by Google in September 2025 and governed by the FIDO Alliance since April 2026. It lets an AI agent make a purchase with cryptographically signed mandates that record what the user approved, with any payment method: cards, bank transfers or stablecoins.

What is x402?

x402 is an open payment protocol created by Coinbase and governed by the x402 Foundation at the Linux Foundation since July 2026. It uses the HTTP 402 "Payment Required" status code: the server answers with its price, and the client retries the same request with a signed payment, usually in stablecoins.

Are AP2 and x402 competitors?

No. AP2 handles authorization: verifiable evidence that the user approved a purchase. x402 handles payment: moving the money for a request. Each works on its own, and Google released an A2A x402 extension alongside AP2 so that an AP2 flow can settle through x402.

Does x402 require cryptocurrency?

In practice, mostly yes. The protocol is designed so it can be extended to other payment methods, but today x402 payments are made in stablecoins such as USDC, so the buyer and the seller each need a wallet.

How can I limit what an AI agent spends today?

Give each agent its own API key with its own budget. On Eden AI, a key can have a spending cap that resets daily, weekly or monthly, an alert threshold and an expiry date, and the key stops working when the budget reaches $0. The management key that creates these keys stays with you, never with the agent.

good to know

Good to know

AP2 and x402 are both young standards, and most adoption figures come from the companies behind them. Eden AI does not support AP2 or x402 today: the spending controls described here are API key budgets.

Similar articles

Designing software for AI agents, not just for humans: booking a table by hand versus an AI agent booking it in one tool call
AI Workflow
Generative AI
Designing Software for AI Agents, Not Just Humans
11/16/2026
·
Written byClément Moreau
AI Workflow
Generative AI
MCP Token Costs: You Pay for the Tools Your Agent Never Calls
10/30/2026
·
Written byClément Moreau
AI Workflow
Generative AI
LLM Proxy vs OpenTelemetry: Do You Need Your Own AI Gateway?
10/23/2026
·
Written byClément Moreau
let’s start

Start building with Eden AI

A single interface to integrate the best AI technologies into your products.