LevelUpWith

Explore / AI Engineering

Agentic Commerce: Safe AI Checkout and Payments

Build checkouts that let AI agents find, buy and pay safely. You'll use scoped single-use tokens, mandates, HTTP 402 payments and deterministic confirmation, and learn to check which protocols are live, where and for whom.

Read lesson 1 free →

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor.

Photographic 3D course artwork for Agentic Commerce: Safe AI Checkout and Payments

Expert · 40 levels · 4 free · Created Nov 2026 · Professionally curated by levelupwith.com

What's inside

  1. Level 1: When Software Spends Money: Intent, Authority, LiabilityFree
    Learn why an AI agent buying something is different from a human clicking 'Pay': the system has to show what the user meant to buy (intent), that the user allowed this purchase (authority), and who pays when it goes wrong (liability).
    • Break a real agent purchase into an intent, an authority and a liability question, and write down the evidence a system would need to keep for each
    • Name three ways an agent purchase can go wrong that a normal web checkout never faces, such as a misread request, a stale authorisation or a purchase the user did not expect
    • Exercise: write a one-page 'purchase evidence' spec in Markdown for a sample order placed by an agent
  2. Level 2: Who's Who in a Payment: Parties and Liability ShiftsFree
    Map the parties in an agent purchase: buyer, agent platform, merchant of record, payment service provider, acquirer, card network and issuer. Then see where the current rules leave liability with agents involved and where they say nothing yet.
    • Draw the party diagram for an agent-made card purchase and mark who sees which data and who carries which risk
    • Explain what 'merchant of record' means and why it decides who handles refunds, tax and disputes
    • Exercise: for three scenarios (wrong item, unauthorised purchase, item never delivered), write down which party you expect to be liable and mark where current rules are unclear
  3. Level 3: Card Payments Refresher: Auth, Capture, Tokens, PCI
    Review how a card payment actually moves money: authorisation, capture, settlement and refunds. Cover how network tokens and processor tokens keep raw card numbers away from your code and out of PCI scope.
    • Run authorise-then-capture and a refund in a payment provider's test mode, and read each state change in the API responses
    • Explain the difference between a raw card number (PAN), a network token and a processor-side payment method token, and why agents should only ever handle the last two
    • Exercise: in a sandbox, write a Python or TypeScript script that authorises, partly captures and refunds a test payment, then log the lifecycle events
  4. Level 4: Beyond Cards: Pay by Bank, Wallets and Stablecoins
    Get a practical overview of the other ways agents may pay: account-to-account and open banking payments, digital wallets, and stablecoin transfers. Look at how finality, reversibility and fees differ from cards.
    • Compare cards, pay by bank and stablecoin transfers on refunds, chargeback rights, settlement time and fee shape
    • Explain why 'payments you can't reverse' changes how much you must check before an agent pays
    • Exercise: build a decision table in code that suggests a payment rail for a given order type (low-value API call, physical goods, subscription) and justify each choice
  5. Level 5: Vendor-Neutral Tool Calling for Commerce
    Define commerce tools such as search_products and get_product with JSON Schema, and call them through one thin adapter that works with Claude, OpenAI, Gemini and an open-weight model served locally.
    • Write one JSON Schema tool definition and translate it into each provider's tool-calling format
    • Build a provider adapter in Python or TypeScript that sends tool calls in the same shape whichever model answers
    • Exercise: run the same 'find me a waterproof jacket under £120' prompt against four models and diff the tool calls they produce
  6. Level 6: Build a Basic Shopping Agent Loop
    Build a working agent loop that searches a mock catalogue, compares options and proposes a cart. The agent stops at a proposal and never places an order itself, which sets up the 'model proposes, system confirms' pattern used later.
    • Write an agent loop that runs tool calls until the model returns a structured cart proposal
    • Validate the proposed cart against a schema and reject malformed or incomplete proposals
    • Exercise: extend the mock store with stock and price data and have the agent produce a valid cart proposal on all four models
  7. Level 7: Threat Model the Naive Shopping Agent
    Break the agent from the last level on purpose. Find made-up prices and SKUs, prompt injection hidden in product descriptions, overspending and runaway loops, then turn each failure into a control you'll build later in the course.
    • Show a prompt injection that comes in through product data and explain why the model can't be the security boundary
    • List the failure modes of an agent with buying power, with likelihood and impact for each
    • Exercise: write a red-team test file of at least eight adversarial cases and record which of the four models fail each one
  8. Level 8: The Agentic Commerce Protocol Stack
    Sort the protocols into layers: tool and catalogue discovery (MCP, product feeds), checkout (ACP, Google's UCP), payment authorisation and mandates (AP2, shared payment tokens), agent trust (Visa Trusted Agent Protocol, Mastercard Agent Pay) and machine payments (x402, MPP).
    • Place each named protocol in its layer and explain which problem it solves and which it leaves open
    • Spot where protocols complement each other and where they compete for the same job
    • Exercise: draw a layered architecture diagram for a merchant that wants to sell through several AI agent platforms
  9. Level 9: Verifying What's Live, in Pilot or Only Announced
    Learn a repeatable way to check protocol status against primary sources: spec repositories and version dates, official docs, issuer and network press releases. Learn to tell a live production flow from a controlled test transaction or an announcement.
    • Classify a protocol claim as live, pilot, controlled test or announced, and cite the primary source
    • Record the region and audience for each status, because 'live in Europe with some issuers' is not the same as 'generally available'
    • Exercise: build a dated status matrix (JSON or Markdown) for ACP, UCP, AP2, Visa Intelligent Commerce, Mastercard Agent Pay and x402, with a primary-source link for every cell
  10. Level 10: ACP Checkout: Sessions from Create to Complete
    Take apart the Agentic Commerce Protocol, the open standard Stripe and OpenAI first released for Instant Checkout in ChatGPT, through its checkout-session lifecycle. Implement the merchant-side endpoints from the published OpenAPI spec.
    • Implement create, update, complete and cancel endpoints for checkout sessions, checked against the published ACP OpenAPI and JSON Schema files
    • Make the server, not the agent, return the authoritative line items, totals and fulfilment options
    • Exercise: build a mock ACP merchant server in Python or TypeScript and drive it with a scripted agent client through a full checkout
  11. Level 11: ACP Payments: Delegated Credentials and Shared Tokens
    Learn how ACP passes payment authority without exposing card details: delegated payment and Stripe's Shared Payment Tokens, which the provider scopes to a merchant and an amount. Also see how merchants on other payment providers fit in.
    • Trace who creates, holds, scopes and redeems a shared payment token in an ACP purchase
    • Explain why the merchant still has to check the token's limits against the final server-side total
    • Exercise: in Stripe's test mode (or a mock if it isn't available in your region), complete an ACP checkout using a scoped test token and show that an over-limit charge fails
  12. Level 12: Google's Universal Commerce Protocol (UCP)
    Study UCP, the checkout protocol Google built with retailers and Shopify for buying through AI Mode and Gemini. Focus on how it separates payment instruments from payment handlers, and compare it with ACP.
    • Explain UCP's checkout capabilities and its split between payment instruments and payment handlers
    • Compare UCP and ACP field by field for one checkout and note what a merchant would need to support both
    • Exercise: write an adapter layer that maps your internal checkout model to both ACP and UCP request and response shapes
  13. Level 13: AP2: Intent, Cart and Payment Mandates
    Learn how Google's Agent Payments Protocol uses signed mandates (intent, cart and payment) as proof of what the user authorised, both when the user is present and when the agent buys on its own.
    • Describe what each AP2 mandate type contains and at which step of a purchase it is signed
    • Explain the difference between human-present and human-not-present flows and the extra proof the second one needs
    • Exercise: using the public AP2 samples or spec, trace one human-not-present purchase and list every signed artifact a verifier would check
  14. Level 14: Visa Intelligent Commerce and Trusted Agent Protocol
    See how Visa approaches agent commerce: the Trusted Agent Protocol, which lets merchants tell known AI agents from unwanted bots, the Agent Directory, and Intelligent Commerce Connect for merchants accepting several protocols. Check what Visa says is live, and where.
    • Explain how a merchant would verify that a request comes from a registered agent rather than a scraper
    • Summarise, with sources, where Visa reports live agent transactions and with which participants
    • Exercise: build a middleware stub that checks a signed agent-identity header against a mock agent directory and logs whether it accepts or rejects each request
  15. Level 15: Mastercard Agent Pay and Verifiable Intent
    Study Mastercard Agent Pay's approach: agent-specific tokens, Verifiable Intent linking an agent's action to the consumer's explicit authorisation, passkey authentication, and the Agent Suite sandbox for testing. Separate the European live tests from wider availability.
    • Explain how agent-specific tokens and Verifiable Intent split up the jobs of identity, authority and payment credentials
    • State, with sources, what Mastercard reports as enabled in Europe and what is still a test or sandbox
    • Exercise: compare Visa's and Mastercard's agent trust models in a structured table and pick out which parts a merchant's code actually has to touch
  16. Level 16: HTTP 402 and x402 Machine Payments
    Learn how x402 turns the long-unused HTTP 402 Payment Required status into a pay-per-request flow: the server quotes a price, the client pays, a facilitator checks the payment and the server delivers. Cover its governance under the x402 Foundation and where it fits best.
    • Implement a server endpoint that answers 402 with payment requirements and serves the content after a valid payment
    • Explain the facilitator's role, settlement finality and why x402 suits low-value API and content calls better than physical goods
    • Exercise: build a paid API endpoint on a test network and an agent client that pays automatically, but only within a hard per-call price ceiling
  17. Level 17: Choosing Protocols: MPP, x402 and the Hybrid Stack
    Compare the machine-payment options (x402 and the Machine Payments Protocol) and the checkout options (ACP and UCP) for real merchant situations, and decide what to build now and what to only watch, noting where practice is still unsettled.
    • Pick a protocol combination for three merchant profiles and justify it by reach, rail, refund rules and maturity
    • Design a protocol-agnostic internal checkout core so that adding or dropping a protocol doesn't mean rewriting it
    • Exercise: write an architecture decision record (ADR) for your own store choosing which protocols to support in the next six months, citing primary sources and status dates
  18. Level 18: Scoped, Single-Use Payment Tokens
    Build your own scoped payment-token service that binds a token to one merchant, a maximum amount, a currency, an expiry time and a single use, and see why each limit closes a specific attack.
    • Implement token issuing and redeeming with merchant, amount cap, currency, expiry and single-use limits enforced on the server
    • Handle replay, an over-limit charge and an expired token with clear, machine-readable errors
    • Exercise: write a test suite that tries to reuse, extend and redirect a token to another merchant, and prove every attempt fails
  19. Level 19: Spend Limits and Budgets Enforced Server-Side
    Add layered spending controls (per transaction, per day, per merchant category and lifetime budget) backed by a ledger, so the system rather than the model decides whether a purchase fits the allowance.
    • Design a spend-ledger table and atomic check-and-reserve logic that stays correct when two purchases run at the same time
    • Enforce category and time-window limits, and return the remaining budget to the agent as a structured response
    • Exercise: run two agent purchases at the same moment against a £100 daily limit and show the ledger never lets the total go over
  20. Level 20: Signed Mandates: Proving What the User Authorised
    Build tamper-evident mandates by signing a user's intent and final cart with Ed25519 or a JWS, then check them at checkout. This makes 'the user agreed to this' something the code can verify rather than an assumption.
    • Define intent-mandate and cart-mandate payloads with limits, expiry and a hash of the cart contents
    • Sign and verify mandates in Python and TypeScript, and reject any cart that differs from what was signed
    • Exercise: build a verifier that blocks checkout when the price, quantity or merchant has changed since the user signed, and log the reason for each rejection
  21. Level 21: Signed Intent Mandates
    Learn how to turn a user's spoken or written goal into a signed, machine-checkable intent mandate, following the idea behind AP2's Intent Mandate, that sets exactly how far an agent may act.
    • Write an intent mandate schema in Python and TypeScript with merchant, category, price ceiling, expiry and audience fields
    • Sign and verify the mandate with an ECDSA P-256 key and refuse any mandate that is expired, tampered with or addressed to a different agent
    • Explain how a human-present intent differs from a human-not-present one, and why the second needs tighter limits
  22. Level 22: Cart Mandates: Binding Approval to the Exact Cart
    Learn to tie the user's approval to a hash of the exact cart (items, quantities, price, merchant), so a cart that changes after approval can't reuse the signature.
    • Build a canonical cart hash and a cart mandate signed by both the merchant and the user
    • Write a check that rejects payment when the cart being charged differs in any way from the cart that was approved
    • Describe the 'signed the transaction but not the decision' gap that researchers have reported in mandate protocols, and add a binding check against it
  23. Level 23: User Confirmation and Step-Up Rules
    Design confirmation steps that are triggered by policy, not by the model's judgement, so that a person approves the purchases that matter and low-risk repeat orders go through without friction.
    • Write a confirmation policy engine with thresholds on amount, merchant, category and novelty
    • Build a confirmation screen that shows server-calculated totals, never figures written by the agent
    • Handle confirmation timeouts, declines and approvals that come back after the cart has changed
  24. Level 24: Agent-Readable Product Feeds
    Publish a product catalogue that agents can read reliably, using structured feeds such as the ACP product feed and schema.org Product markup instead of HTML that has to be scraped.
    • Generate a product feed with stable IDs, variants, prices, availability and shipping data from an existing catalogue
    • Check the feed against its schema in CI and catch missing or inconsistent fields before they are published
    • Compare what a feed, structured page markup and a product-search tool endpoint each offer an agent
  25. Level 25: Catalogue Trust: Freshness and Injection-Safe Data
    Keep agent-facing catalogue data current and safe: stale prices, oversold stock and instructions hidden in product text are each treated as a separate failure mode.
    • Add freshness timestamps and version checks so agents and checkout reject out-of-date prices and stock
    • Strip and flag instruction-like text in titles, descriptions and reviews before it reaches a model
    • Write tests that pass a poisoned product record through Claude, OpenAI, Gemini and an open-weight model and confirm checkout is unaffected
  26. Level 26: The Checkout State Machine
    Model checkout as an explicit server-side state machine in which the agent can only request transitions and the server alone sets price, stock, tax and totals.
    • Implement states from cart through ready-for-payment, authorised and completed or cancelled, with only legal transitions allowed
    • Recalculate every total on the server for each transition and ignore any amount the agent sends
    • Map the ACP checkout-session lifecycle onto your state machine and note where the two differ
  27. Level 27: Idempotency Keys and Safe Retries
    Make every operation that touches money safe to retry, because agents time out, loop and call tools twice, and a duplicate must never become a second charge.
    • Add idempotency keys to create-order and pay endpoints, storing requests and replaying stored responses
    • Pass idempotency keys through to your payment provider and detect a reused key that arrives with a different payload
    • Run a chaos test that retries and duplicates agent tool calls and confirm exactly one charge per order
  28. Level 28: Schema-Validated Agent Requests
    Put strict schemas between the model and checkout, so malformed, partial or invented tool arguments are rejected before any business logic runs.
    • Define checkout tool schemas once with Pydantic and Zod, and export them to the Claude, OpenAI, Gemini and open-weight tool formats
    • Reject unknown fields, invalid enums and out-of-range quantities, and return error messages the model can act on
    • Measure how often each model produces invalid arguments on a fixed test set and log the results
  29. Level 29: Prompt Injection Defences at Checkout
    Defend the purchase path against instructions hidden in web pages, emails, product data and merchant responses, by separating untrusted content from tool authority.
    • Classify every input to the agent as trusted or untrusted, and stop untrusted content from widening the scope of a mandate
    • Use allowlists of merchants and destinations, and require confirmation for any action that an untrusted source triggered
    • Build a set of injection attack cases and run it against the agent on every change
  30. Level 30: Catching Hallucinated and Mismatched Orders
    Detect when what the agent says it bought differs from what the system actually created, and make the server's order record the only source of truth.
    • Write a reconciliation check that compares the agent's summary with the confirmed order and flags any difference
    • Block orders for products, variants or merchants that the catalogue does not hold
    • Rewrite agent replies so they quote the server's order record, never the model's own memory of the order
  31. Level 31: Webhooks, Async Payments and Compensation
    Handle what happens after checkout: asynchronous payment results, partial failures, cancellations and refunds, all driven by verified webhooks and not by the agent's own polling.
    • Verify webhook signatures and process events idempotently and in any order
    • Write compensating actions (void, refund, release stock) for each failure point after authorisation
    • Tell the user and the agent about final order outcomes without leaking internal state
  32. Level 32: Fraud Signals for Agent-Made Orders
    Change your fraud thinking for agent traffic, where classic bot signals stop working and mandate, agent identity and behaviour signals become the useful ones.
    • Explain why rules that block automation by default turn away legitimate agent buyers
    • Build a risk score that combines mandate checks, agent identity, velocity and changes in basket pattern
    • Route orders to approve, step-up or review, and log the reasons so they can be audited
  33. Level 33: Disputes and Chargebacks with Agent Evidence
    Prepare for disputes such as 'my agent bought the wrong thing' by keeping mandates, confirmations and order logs as evidence, and learn where liability rules are still unsettled.
    • Write an evidence bundle that links the signed mandates, confirmation events and fulfilment to one order
    • Use a payment sandbox to simulate dispute flows and submit evidence
    • Say plainly which agent-dispute scenarios card network rules don't yet clearly cover
  34. Level 34: Agent Identity and Signed Agent Requests
    Recognise and authenticate the agents that call your store, using cryptographically signed HTTP requests of the kind behind Visa's Trusted Agent Protocol and similar web bot authentication schemes.
    • Verify HTTP message signatures on incoming agent requests against the agent's published keys
    • Tell trusted shopping agents apart from anonymous scrapers in middleware, and give each its own rate limits and permissions
    • Compare network-led and open-standard approaches to agent identity, and say where they have not yet converged
  35. Level 35: KYC, Know-Your-Agent and Merchant of Record
    Work out who is accountable in an agent purchase (user, agent platform, merchant, payment provider) and what identity checks each party carries out.
    • Map the merchant of record, payment provider and agent platform roles for ACP-style and AP2-style flows
    • Decide what account linking and KYC your platform needs before an agent may spend on a user's behalf
    • Write an onboarding checklist for allowing a new agent platform to transact with your store
  36. Level 36: Strong Customer Authentication in the UK and EU
    Apply PSD2 and UK strong customer authentication to agent purchases at a practical level: when SCA applies, which exemptions and merchant-initiated flows might fit, and where the regulatory position is still unclear.
    • Decide whether SCA is needed for human-present, delegated and merchant-initiated agent transactions
    • Run 3-D Secure challenges and exemption requests in a sandbox and handle each outcome
    • Write down which agent scenarios still need a regulatory or legal opinion before launch
  37. Level 37: US Rules for Agent Payments in Practice
    Get a practical working view of US consumer payment rules as they apply to agent purchases: card-network rules, protections for unauthorised transactions on credit and debit, and disclosure duties, with no legal overreach.
    • Explain how unauthorised-transaction protections differ between credit cards, debit cards and account-to-account payments
    • Find the points in your flow where disclosure, consent records and cancellation rights apply
    • Put together a list of open questions for counsel, separating settled rules from areas still in flux
  38. Level 38: Repeatable Sandbox Test Suites
    Build a test suite that runs agents end to end against payment sandboxes and test networks, with recorded model runs, so checkout safety is checked on every change.
    • Run test-mode cards, shared tokens, dispute triggers and x402 test-network payments from one test harness
    • Record and replay agent runs for Claude, OpenAI, Gemini and an open-weight model to make tests deterministic
    • Write safety checks that fail the build if any change produces a charge without a mandate or without confirmation
  39. Level 39: Final Project: Ship an Agent-Ready Checkout
    Build and demonstrate a full agent-ready checkout in a payment sandbox, with a readable catalogue, scoped single-use tokens, signed mandates, policy-driven confirmation and a server-owned state machine.
    • Deliver a working checkout that a model-agnostic agent can use end to end in sandbox mode
    • Show that it rejects tampered carts, duplicate calls, injected instructions and over-limit spending
    • Hand in the test suite, the evidence bundle and a one-page risk and compliance note
  40. Level 40: Comprehensive Course Review Exam
    Bring the whole course together by reviewing a realistic agent-commerce design against intent, authority, liability, protocol status, credentials, deterministic checkout, risk, identity and regulation.
    • Review an agentic checkout design and find its safety, liability and compliance gaps
    • Choose a suitable protocol and payment approach for a given market and use case, and back the choice with primary sources
    • Set out a launch plan that separates what is live today from what is still in pilot or unsettled

Access

Levels 1 and 2 are free to read, no account needed. Levels 3 and 4 are free with a free account, and so are 20 answers from the AI tutor. Every level, the podcast edition and the AI tutor come with All Access at £4.99/month or any Creator plan — see pricing.

Read lesson 1 free →