Home/Technologies/How AI Payments Work: AP2 and x402 Protocols Explained
Technologies

How AI Payments Work: AP2 and x402 Protocols Explained

AI payments allow autonomous agents to search, compare, and independently pay for products within user-set limits. This guide explains how AP2 and x402 protocols enable secure, automated transactions, discusses risk mitigation, and explores the future of AI-driven financial automation.

Nov 26, 2026
6 min
How AI Payments Work: AP2 and x402 Protocols Explained

AI payments empower artificial intelligence not only to search for products, compare prices, and recommend services, but also to independently pay for purchases within user-defined limits. For example, an autonomous agent can monitor airline ticket prices and buy a ticket when the price drops below a set threshold.

To enable these scenarios, payment protocols AP2 and x402 have been developed. The first helps confirm the user's intent and the agent's authority, while the second allows payments to be made directly when accessing online resources.

Let's explore how these protocols work, why autonomous AI agents need them, and what mechanisms make it possible to control their spending.

What Are AI Payments and How Do They Work?

AI payments are financial transactions initiated by artificial intelligence on behalf of a user or organization. Unlike typical automatic billing, an autonomous agent can independently choose the recipient, timing, and amount of payment within the granted permissions.

The purchasing process involves several steps:

  • The user sets a task and defines a budget.
  • The AI agent searches for suitable products or services.
  • The agent compares offers and checks purchase conditions.
  • The payment system verifies the agent's authority.
  • Payment is made, and the user receives information about the transaction.

Neural networks don't necessarily need direct access to a bank card. Payment tokens, digital wallets, and limited permissions can be used to process transactions.

This automation is valuable not only for everyday purchases but also for corporate procurement. Learn more about the possibilities of autonomous systems in the article AI Agents in Business: Applications, Examples, and Future Trends.

How the AP2 Protocol from Google Works

AP2 (Agent Payments Protocol) is an open protocol developed by Google in collaboration with industry partners. Its purpose is to give merchants and payment systems verifiable proof that an AI agent is acting with the user's permission.

At the core of AP2 are digital mandates-cryptographically signed documents that outline the conditions for a transaction. The initial AP2 model includes three types of mandates:

  • Intent Mandate - defines the user's intentions, purchase requirements, and budget limits.
  • Cart Mandate - records the cart contents, product prices, and order terms.
  • Payment Mandate - confirms authority to make a specific payment.

In the latest specification, future purchase conditions and the finalized order are also captured with open and closed checkout mandates.

AP2 supports two payment scenarios. In the first, the user reviews and confirms the selected product before purchase. In the second, the user sets constraints in advance, allowing the agent to act independently within those limits.

For example, a user might instruct the agent to buy a specific monitor model for no more than 30,000 rubles. When a suitable offer appears, the agent places the order within the granted permission.

AP2 is not a standalone payment system. It enables authority verification, while cards, transfers, or stablecoins can be used for the actual payment.

How the x402 Protocol Enables AI Agents to Pay Online

x402 is an open payment protocol originally developed by Coinbase. It leverages the HTTP 402 Payment Required status code, enabling payments to be made directly when interacting with web services.

Instead of subscribing or manually entering payment details, an AI agent can automatically pay for access to individual online resources.

The payment process via x402 works as follows:

  1. The AI agent sends a request to a paid resource.
  2. The server responds with HTTP 402, specifying the price, currency, and payment recipient.
  3. The agent checks the terms and generates a signed payment authorization.
  4. The server verifies the authorization and processes the payment either directly or via a facilitator.
  5. The agent receives the requested data or service.

Stablecoins like USDC on blockchain networks such as Base or Solana may be used for settlements.

For instance, if an AI agent needs up-to-date stock quotes via a paid API, it can pay for each individual request (e.g., $0.01) instead of subscribing for a month.

This model is especially convenient for micropayments, data access, computational resources, and agent-to-agent interactions.

AP2 vs x402: Differences and Combined Usage

AP2 mainly confirms the user's intent and the agent's authority, while x402 provides a payment mechanism for accessing online resources. These protocols can be used separately or together.

FeatureAP2x402
DeveloperGoogle & partnersCoinbase
Main FunctionAuthority confirmationPayment processing
MethodDigital mandatesHTTP 402
Payment MethodsCards, transfers, stablecoinsMainly stablecoins
Typical Use CasesPurchases, bookingMicropayments, API access

For example, if a user delegates trip planning to an AI agent, AP2 can specify the maximum ticket price, travel dates, and allowed purchase conditions. During the search process, the agent may use x402 to pay for real-time flight data and schedules.

The combined use of these protocols merges spending control with automatic payment processing. An x402 extension for the A2A (Agent-to-Agent) protocol has been developed for such scenarios.

However, for a standard purchase via AP2, x402 is not required, and digital resource payments via x402 can be made without AP2. The choice depends on the service's needs and payment authorization method.

How Safe Are Autonomous AI Agent Payments?

The main risk of AI payments is that the agent might misinterpret a task, select an unsuitable product, or make an unnecessary purchase. Cryptographic payment protection alone does not guarantee the correctness of a decision.

The following mechanisms help reduce risks:

  • Spending limits - restrict the amount per transaction and total budget.
  • Authority restrictions - only allow purchases in specific categories or approved services.
  • Expiration of permissions - automatically revoke agent rights after a set period.
  • Additional confirmation - require user approval for large or unusual transactions.
  • Transaction logs - keep a record of payments and issued permissions.

Prompt injection attacks are a unique threat. Malicious instructions on e-commerce pages can influence an agent and attempt to force an unwanted purchase. Read more in the article Prompt Injection in AI: How to Protect Neural Networks from Attacks and Manipulation.

There are also financial limitations. While certain card payments can be disputed, confirmed stablecoin transfers are typically irreversible. For broad adoption of AI payments, clear refund procedures, dispute resolution, and allocation of responsibility among the user, agent developer, and merchant are essential.

Conclusion

AI payments transform autonomous agents from tools for search and analysis into full-fledged participants in e-commerce. The AP2 protocol enables agent authority and purchase condition verification, while x402 streamlines automatic payment for digital resources and services.

The most promising applications for these technologies include corporate procurement, ticket booking, finding the best deals, and micropayments for API usage.

However, the mass adoption of AI payments depends not only on the development of payment infrastructure but also on security. Users must retain the ability to limit spending, revoke permissions, and contest erroneous transactions. Agent autonomy should never mean loss of financial control.

Tags:

ai payments
autonomous agents
ap2 protocol
x402 protocol
ai security
micropayments
digital wallets
stablecoins

Similar Articles

Loading...