Skip to content

AP2-style mandates

The Agent Payments Protocol (AP2) describes how a user delegates purchasing to an agent through signed mandates:

  • an intent mandate: what to buy, from whom, and until when;
  • a cart mandate: a merchant-signed cart the user approved;
  • a payment mandate.

CredenceStack models these as plain Pydantic objects (no SD-JWT or signature checks) and turns them into a temporary authority profile. That way, "the agent stayed within the user's mandate" is tested with the same grader and evidence as company authority rules.

# scenario
authority_mandate: fixtures/mandate_cap_400.json
authority: {agent_id: shopping-agent, clock: "2026-10-14T15:00:00Z"}

The conversion is in place and tested (tests/fixtures/ap2/ holds example mandates). The four mandate scenarios (price above the cap, wrong merchant, expired mandate, cart quantity changed after approval) need a shopping environment with merchants and carts, which the simulated back office does not have yet; they are on the roadmap.

Mapping to a profile

Mandate Profile (one purchase grant) Status
constraints.max_amount per_txn_limit CredenceStack extension, TODO-verify (AP2's IntentMandate has no structured price cap)
IntentMandate.merchants allowed_counterparties (merchant names) field verified; names vs ids TODO-verify
IntentMandate.intent_expiry, CartContents.cart_expiry valid_until (earliest) fields verified; interpretation ours
CartMandate bound_objects: cart id, total, display-item labels fields verified; binding rule ours
user_cart_confirmation_required and no cart mandate requires_human_above: 0 field verified; interpretation ours

What is verified and what is not

Verified against the AP2 Python SDK (code/sdk/python/ap2/models/mandate.py and payment_request.py in github.com/google-agentic-commerce/AP2):

  • Mandate field names, types and defaults:
  • IntentMandate: user_cart_confirmation_required, natural_language_description, merchants, skus, requires_refundability, intent_expiry
  • CartContents: id, user_cart_confirmation_required, payment_request, cart_expiry, merchant_name
  • CartMandate: contents, merchant_authorization
  • PaymentMandateContents: payment_mandate_id, payment_details_id, payment_details_total, payment_response, merchant_agent, timestamp
  • PaymentMandate: payment_mandate_contents, user_authorization
  • W3C payment types:
  • PaymentCurrencyAmount: currency, value
  • PaymentItem: label, amount, pending, refund_period
  • PaymentDetailsInit: id, display_items, shipping_options, modifiers, total
  • PaymentRequest: method_data, details, options, shipping_address
  • The data-key naming: ap2.mandates.IntentMandate, ap2.mandates.CartMandate, ap2.mandates.PaymentMandate.

TODO-verify against ap2-protocol.org:

  • the constraints block, which is not an AP2 object;
  • whether merchants holds names or identifiers;
  • how expiry, cart binding and confirmation should be interpreted as authority rules;
  • the signature formats of merchant_authorization and user_authorization, which are carried as opaque strings and not checked.

The models are deliberately permissive (extra="allow"), so newer AP2 fields do not break loading. All AP2-specific code is in src/credencestack/integrations/ap2.py.