ucp-ap2-mandates

Implement UCP AP2 Mandates extension — cryptographic payment mandates for fully autonomous agent commerce using SD-JWT credentials, merchant authorization signatures, and the Agent Payments Protocol. Use when building autonomous agent payment flows without human-in-the-loop.

17 stars

Best use case

ucp-ap2-mandates is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Implement UCP AP2 Mandates extension — cryptographic payment mandates for fully autonomous agent commerce using SD-JWT credentials, merchant authorization signatures, and the Agent Payments Protocol. Use when building autonomous agent payment flows without human-in-the-loop.

Teams using ucp-ap2-mandates should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/ucp-ap2-mandates/SKILL.md --create-dirs "https://raw.githubusercontent.com/OrcaQubits/agentic-commerce-skills-plugins/main/dist/antigravity/ucp-agentic-commerce/.agent/skills/ucp-ap2-mandates/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/ucp-ap2-mandates/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How ucp-ap2-mandates Compares

Feature / Agentucp-ap2-mandatesStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Implement UCP AP2 Mandates extension — cryptographic payment mandates for fully autonomous agent commerce using SD-JWT credentials, merchant authorization signatures, and the Agent Payments Protocol. Use when building autonomous agent payment flows without human-in-the-loop.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# UCP AP2 Mandates Extension

## Before writing code

**Fetch live spec**:
- Web-search `site:ucp.dev specification ap2-mandates` for the extension schema
- Fetch https://ucp.dev/2026-01-23/documentation/ucp-and-ap2/ for the conceptual relationship
- Web-search `site:ap2-protocol.org` for the AP2 protocol specification

## Conceptual Architecture

### What AP2 Enables

AP2 (Agent Payments Protocol) enables **fully autonomous agent commerce** — the agent can authorize payments cryptographically without requiring real-time human approval for each transaction. The user pre-authorizes spending parameters, and the agent proves authorization via signed credentials.

### Two Mandate Artifacts

1. **Checkout Mandate** (`ap2.checkout_mandate`): An SD-JWT+kb (Selective Disclosure JWT with Key Binding) credential that proves the user authorized the agent to complete this specific checkout at these specific terms.

2. **Payment Mandate** (`payment_data.token`): A separate credential proving payment authorization, verified by the PSP (not the Business).

### Merchant Authorization

Before the Platform generates mandates, the Business must sign the checkout terms:
- Format: **JWS Detached Content** (RFC 7515 Appendix F) — `<header>..<signature>`
- Canonicalization: **JSON Canonicalization Scheme** (RFC 8785)
- Algorithms: ES256, ES384, ES512 (elliptic curve)

The Business returns this `merchant_authorization` in the checkout response.

### 7-Step Flow

1. **Discovery** — Business publishes AP2 support in capabilities
2. **Session Activation** — Platform signals AP2 intent
3. **Business Signing** — Business returns checkout + `merchant_authorization` (JWS detached content)
4. **Authorization Generation** — Platform creates CheckoutMandate (SD-JWT-VC) + PaymentMandate
5. **Submission** — Platform sends both mandates in the `complete_checkout` call
6. **Verification** — Business verifies checkout mandate; PSP verifies payment mandate
7. **Confirmation** — Order confirmed

### Security Lock

Once AP2 is negotiated for a checkout session, a **Security Lock** is activated: neither party may revert to a standard (non-AP2) checkout flow for that session. This prevents downgrade attacks where a malicious actor could bypass the cryptographic mandate requirements by falling back to a simpler payment flow.

### Error Codes

AP2-specific errors:
- `mandate_required` — AP2 mandates needed but not provided
- `agent_missing_key` — Agent's signing key not found
- `mandate_invalid_signature` — Signature verification failed
- `mandate_expired` — Mandate past validity window
- `mandate_scope_mismatch` — Mandate doesn't match checkout terms
- `merchant_authorization_invalid` — Business signature invalid
- `merchant_authorization_missing` — Business didn't sign terms

### Implementation Guidance

This is the most complex UCP extension. Before implementing:

1. Understand SD-JWT-VC (Selective Disclosure JWT Verifiable Credentials) — this is the credential format
2. Understand JWS Detached Content (RFC 7515 Appendix F) — this is the merchant signing format
3. Understand JSON Canonicalization (RFC 8785) — deterministic JSON serialization for signing
4. Fetch the latest AP2 protocol spec from https://ap2-protocol.org for the full mandate lifecycle
5. Check the conformance test suite: https://github.com/Universal-Commerce-Protocol/conformance (ap2_test.py)

This extension is intended for advanced autonomous agent scenarios. Most initial implementations should start with standard payment handlers (Google Pay, Shop Pay) before adding AP2.

Related Skills

woo-testing

17
from OrcaQubits/agentic-commerce-skills-plugins

Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.

woo-shipping

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.

woo-setup

17
from OrcaQubits/agentic-commerce-skills-plugins

Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.

woo-security

17
from OrcaQubits/agentic-commerce-skills-plugins

Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.

woo-plugin-dev

17
from OrcaQubits/agentic-commerce-skills-plugins

Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.

woo-performance

17
from OrcaQubits/agentic-commerce-skills-plugins

Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.

woo-payments

17
from OrcaQubits/agentic-commerce-skills-plugins

Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.

woo-hooks-filters

17
from OrcaQubits/agentic-commerce-skills-plugins

Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.

woo-frontend

17
from OrcaQubits/agentic-commerce-skills-plugins

Customize WooCommerce frontend — template overrides, theme integration, shortcodes, hooks for product/cart/checkout display, and WooCommerce block themes. Use when modifying the storefront appearance or building WooCommerce themes.

woo-deploy

17
from OrcaQubits/agentic-commerce-skills-plugins

Deploy WooCommerce — WP-CLI automation, database migrations, zero-downtime updates, staging workflows, environment configuration, and CI/CD patterns. Use when deploying WooCommerce stores or setting up deployment pipelines.

woo-data-stores

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce CRUD data stores — WC_Product, WC_Order, WC_Customer, WC_Coupon data objects, custom data stores, HPOS migration, and getters/setters. Use when creating or modifying WooCommerce data objects or implementing custom data stores.

woo-custom-fields

17
from OrcaQubits/agentic-commerce-skills-plugins

Work with WooCommerce product attributes, custom meta fields, taxonomies, custom product tabs, and variation data. Use when adding custom data to products, orders, or customers.