DEV Community

Justin Chau
Justin Chau

Posted on AI-assisted

AP2: How AI Agents Prove You Actually Authorized a Payment

If you've been following this series, we've covered how AI agents discover sites, read their content, and complete purchases on a user's behalf. But completing a purchase is only half the problem; when an agent chooses to pay, how is it possible to verify if the human user authorized this exact purchase?

This is where the Agent Payments Protocol (or AP2 for short) comes in. Its goal is not to handle payments or your checkout, but to create cryptographically verifiable records of what the user has authorized, so a transaction can be understood months later without relying solely on server logs.

The Authorization Vacuum

Traditional payments assume a human is sitting in front of a screen clicking buttons. Autonomous agents break that assumption in three distinct ways:

  1. Authorization: What evidence shows the user approved this exact transaction, rather than just giving a vague prompt?
  2. Integrity: What evidence shows the presented cart matches the user's intent, rather than being hallucinated by a downstream tool call?
  3. Accountability: If an agent buys the wrong item or gets prompt-injected, what evidence lets the merchant and processor resolve who approved what?

Conventional server logs can show that something happened, but they don't inherently prove the user authorized that specific cart, amount, and funding source. Without clear answers, financial institutions may treat agent-initiated traffic as higher risk, merchants assume chargeback risk, and users refuse to hand over financial authority.

AP2 provides the cryptographic foundation to make all three parties comfortable.

Mandates: Answering "What Did the User Approve?"

To ensure that payment records are secure and tamperproof, AP2 creates mandates: signed authorization tokens that record the items bought, their prices, and the conditions of their purchase. AP2 specifically uses the Selective Disclosure for JSON Web Token (SD-JWT), which discloses claims while ensuring the digital signature is validated.

AP2 splits these into two types of evidence:

  • Checkout Mandate: Proof that the user approved these specific items, at this price, for this merchant.
  • Payment Mandate: Proof that the user authorized this specific funding source for this transaction.

The distinction between Open and Closed mandates comes down to timing:

  • Open Mandate: The user sets rules upfront (e.g., "Monitor this part and buy it if the price drops below $150"). The agent can act later within those boundaries, but must eventually generate a Closed Mandate to finalize the purchase.
  • Closed Mandate: The agent records the final, specific transaction (e.g., "Buy these exact headphones right now"). It acts as the binding approval for a specific checkout.

Where AP2 Sits in the Stack

Validating this evidence is a shared responsibility. When an agent goes through a UCP checkout, AP2 rides alongside it:

  • The Merchant validates the Checkout Mandate to confirm: "Did the user approve these items and this price?"
  • The Processor or Network validates the Payment Mandate to confirm: "Did the user approve this funding source and transaction?"
  • The User provides the original authorization, confirming: "Did I knowingly set these limits or approve this purchase?"

If any signature fails, the transaction stops. If they succeed, AP2 doesn't just record a transaction; it creates a verifiable chain of evidence through receipts. The user authorizes the purchase, the agent presents the mandate, the merchant issues a Checkout Receipt, and the processor issues a Payment Receipt. If a dispute arises months later, all parties inspect these signed artifacts rather than trying to reconstruct events from application logs.

Practical Takeaways for Builders

AP2 is still relatively new, so you shouldn't refactor your entire billing engine around it tomorrow. But the architecture it requires is just good engineering:

  1. Expose your checkout as an API. If an agent can't programmatically query your cart and get a stable identifier, no authorization protocol can save your integration.
  2. Keep durable order states. Store what the user actually saw—line items, timestamps, and initiator metadata. AP2 standardizes this into signed receipts, but local immutable logging is a smart habit regardless.
  3. Keep an eye on the FIDO Alliance. Google's contribution of AP2 to the FIDO Alliance, where it moves through the Agentic Authentication and Payments groups, signals that it is transitioning into neutral infrastructure, not a proprietary walled garden.

What AP2 Does Not Do

AP2 is a powerful tool, but it has specific boundaries. It answers the question, "Did the human authorize this exact transaction?" But it does not answer, "Was every step before authorization correct?"

A valid signature can confirm that the user approved the final cart, but prompt injection, bad MCP output, or an incorrect agent recommendation may still have shaped that cart. AP2 also doesn't process payments, replace payment rails, or eliminate fraud and chargebacks by itself.

This limitation is a feature of its design, not a flaw. AP2 proves the user authorized the transaction; it doesn't guarantee the agent's reasoning was flawless.

Summary

AP2 doesn't move money. It creates evidence.

Merchants that can produce clear, verifiable authorization evidence will be better positioned to reduce disputes and earn trust from processors, banks, and customers.

Your AI-readiness stack now has four layers: JSON-LD tells parsers what you sell. WebMCP tells browser agents what your page can do. UCP tells commerce agents how to buy. And AP2 creates the evidence that answers the question every payment system must ask: did the human actually approve this exact purchase?

Top comments (0)