Overview & Concepts
What problem does the IXOPAY Payment Agent solve?
AI shopping agents browse stores and buy on behalf of people. Three things get in the way:
- Checkout is built for humans. Forms, CAPTCHAs and redirects don't work for software.
- Prompt injection can become payment injection (PI2PI). A hostile page or message can trick an agent into paying a different amount or for different items than its owner approved.
- Card data is a liability. Merchants who touch raw card numbers take on PCI-DSS audit scope.
The IXOPAY Payment Agent sits between the agent, the merchant and the card networks to address all three:
| Problem | How the Payment Agent handles it |
|---|---|
| No machine checkout | Merchants publish a discovery manifest; agents call /v1/negotiate and /v1/transact. |
| PI2PI cart tampering | The cart is canonicalized (RFC 8785 JCS) and hashed with SHA-256 into an Invoice Hash. The agent's signed mandate carries that hash. Any change to amount, currency, merchant or line items changes the hash and the payment is refused. |
| Card data exposure | Credentials are network tokens (Visa TAP, Mastercard Agent Pay) or IXOPAY tokens. Where a human must enter a card, the TokenEx iFrame collects it inside TokenEx's secure environment. |
The cast
| Role | Who | What they do |
|---|---|---|
| Buyer / user | A person | Approves the order and sets the spending rules used by the agent. |
| Agent | Software acting for the buyer | Browses, builds a cart, signs a mandate, calls the Payment Agent. |
| Merchant | The store | Publishes the manifest and catalog, locks carts, receives settlement notifications. |
| IXOPAY Payment Agent | This product | Locks carts, verifies mandates, enforces spending rules, maps tokens through the vault, and records an audit trail. |
| Vault | IXOPAY | Holds the card data. The Payment Agent only ever handles tokens. |
Two ways to pay
- TokenEx iFrame (customer enters a card). Your server locks the cart, your page shows the TokenEx iFrame, and the card goes straight to the vault. You receive a token and complete the payment. Start with the Quickstart.
- Agent mandate (an AI agent pays). The agent signs a Mastercard Agent Pay or Visa TAP mandate bound to the cart's hash. Described below and in the Agent Developer Guide.
How an agent payment flows
sequenceDiagram
autonumber
participant A as Agent
participant M as Merchant
participant P as IXOPAY Payment Agent
A->>M: GET /.well-known/ai-payments.json
A->>M: GET /products.json
A->>M: Build cart, ask merchant to lock it
M->>P: POST /v1/negotiate
P-->>M: sessionId + invoiceHash (valid 300 s)
M-->>A: sessionId + invoiceHash
Note over A: Sign mandate that includes invoiceHash
A->>P: POST /v1/transact
Note over P: Verify signature<br/>Verify cart matches invoiceHash<br/>Enforce spending rules<br/>Map token in vault
P-->>A: SETTLEMENT_HANDOVER
Either party can request the lock. Before signing, the agent must verify that the locked cart matches the buyer-approved order held in trusted state. After handover, the merchant waits for the processor confirmation required for fulfillment.
Key concepts
Discovery manifest. A JSON file at /.well-known/ai-payments.json that tells an agent which protocols a store supports and where the Payment Agent endpoints are.
Session. Created by /v1/negotiate. It holds the cart's Invoice Hash and expires after 300 seconds. The session moves through a strict state machine (PARAMETER_NEGOTIATION, SIGNATURE_VERIFICATION, PPCB_VALIDATION, VAULT_MAPPING, SETTLEMENT_HANDOVER, or FAILED_TERMINATE). A session can settle once.
Invoice Hash (PPCB). "Protocol Parameter Cryptographic Binding." A SHA-256 hash of the canonical cart. See How the Invoice Hash is computed.
Mandate. A signed statement of what the buyer authorized. The Payment Agent accepts:
- Mastercard Agent Pay (AP4M): a four-layer SD-JWT chain signed with ES256.
- Visa Trusted Agent Protocol (TAP): an RFC 9421 HTTP Message Signature using Ed25519 or RSA-PSS.
L2 mandate (spending rules). Check the buyer’s cap, allowed merchants and SKUs, currency and expiry before signing. The gateway can reject a purchase or issue a pilot challenge for a request-level budget cap. A signed AP4M cap denial may end the attempt.
TokenEx iFrame. For a guest buyer with no pre-delegated card, the TokenEx iFrame on the merchant's page collects the card inside TokenEx's environment. The page receives a token and a tokenHMAC, not a card number.
Audit proof. A gateway-generated record of transaction details and the cart hash. Preserve the original authorization and processor records separately for disputes.
WebMCP tools. Model Context Protocol tools a storefront can expose so agents can search, add to cart, and (with human consent) pay.
Supported protocols and rails
| Protocol | protocol value accepted by /v1/transact | Signature |
|---|---|---|
| Mastercard Agent Pay | AP4M, MASTERCARD_AP4M | ES256 (SD-JWT chain) |
| Visa Trusted Agent Protocol | VISA_TAP, VISA | Ed25519, RSA-PSS-SHA256 |
| TokenEx Direct REST | TOKENEX_REST, TOKENEX | PPCB Invoice Hash + CustomData1–4 |
| TokenEx iFrame | via /v1/checkout/complete | n/a (human-entered, tokenized) |
The discovery manifest (/.well-known/ai-payments.json) advertises only enabled, active rails. It lists the TokenEx iFrame as TOKENEX_IFRAME_HPP. To finish an iFrame payment, call /v1/checkout/complete with protocol: "TOKENEX_DIRECT".
Performance
The Payment Agent's own routing work (verify, bind, map) is designed to stay under 10 ms at p95/p99. This excludes network round trips to card-network sandboxes, which typically add 150–300 ms. Set agent HTTP timeouts to about 5 seconds.
Glossary
See the Glossary for the terms and acronyms used in these docs.