Ap2 Dev Patterns logo

Ap2 Dev Patterns

Organization
OrcaQubits
ap2-dev-patterns

Apply AP2 cross-cutting development patterns — multi-agent payment architecture, UCP integration, x402 crypto payments, testing with mock providers, and production deployment. Use when architecting agentic payment systems or solving cross-cutting payment concerns.

Overview

PublisherOrcaQubits
Repositoryagentic-commerce-skills-plugins
Skill nameap2-dev-patterns
Stars
40
Forks
17
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by OrcaQubits on GitHub. Read the source before you install it.

Installation

Install the Ap2 Dev Patterns AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/ap2-agentic-payments/skills/ap2-dev-patterns
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OrcaQubits/agentic-commerce-skills-plugins.git /tmp/agentic-commerce-skills-plugins
mkdir -p .claude/skills
cp -r /tmp/agentic-commerce-skills-plugins/ap2-agentic-payments/skills/ap2-dev-patterns .claude/skills/ap2-dev-patterns
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ap2 Dev Patterns in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ap2 Dev Patterns on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ap2 Dev Patterns is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

AP2 Development Patterns

Before writing code

Fetch live docs:

  1. Fetch https://ap2-protocol.org/ap2/specification/ for the latest protocol details
  2. Fetch https://ap2-protocol.org/overview/ for UCP integration patterns
  3. Fetch https://ap2-protocol.org/overview/ for x402 crypto integration
  4. Web-search site:github.com google-agentic-commerce AP2 samples for reference architectures

Conceptual Architecture

Multi-Agent Payment Architecture

The standard AP2 architecture involves four agents communicating via A2A:

┌──────────────────────────────────────────────────┐
│                    User                           │
│          (trusted device surface)                 │
└──────────┬───────────────────────────────────────┘
           │ intent + signatures
┌──────────▼───────────────────────────────────────┐
│            Shopping Agent (SA)                     │
│    Orchestrator — coordinates the full flow        │
└──┬──────────────┬────────────────────────────────┘
   │              │
   │ A2A          │ A2A
   │              │
┌──▼──────┐  ┌───▼──────────┐
│ Merchant │  │ Credentials  │
│ Agent    │  │ Provider     │
│          │  │              │
│ catalog  │  │ payment      │
│ cart     │  │ methods      │
│ signing  │  │ tokenization │
└────┬─────┘  └──────────────┘
     │
     │ (Merchant → MPP)
     │
┌────▼─────────────┐
│ Merchant Payment  │
│ Processor (MPP)   │
│                   │
│ authorization     │
│ settlement        │
│ Payment Mandate   │
│ challenges        │
└────────┬──────────┘
         │
    ┌────▼──────────┐
    │ Network/Issuer │
    │ (Visa, MC,     │
    │  banks)        │
    └────────────────┘

Important: The SA communicates with the Merchant and the CP via A2A. The Merchant communicates with the MPP. The SA does not directly communicate with the MPP.

UCP Integration Pattern

UCP (Universal Commerce Protocol) operationalizes AP2:

  • UCP's Checkout object maps to a commerce-level checkout flow
  • UCP's checkout_mandate is distinct from (but related to) AP2's Checkout Mandate — checkout_mandate is a UCP-specific concept that wraps the commerce checkout authorization, while AP2's Checkout Mandate is the cryptographically signed VDC binding user consent to specific transaction terms
  • UCP's /complete_checkout API = AP2's payment authorization step
  • PaymentMandate (constructed by the MPP) proves payment authorization for the network/issuer

Use UCP when you need the full commerce checkout flow (catalog, cart, checkout, orders) with AP2's payment security.

x402 Crypto Payment Pattern

AP2 supports emerging digital payment methods via x402:

  • AP2 is payment-method agnostic — supports cards and crypto
  • x402 represents a specific crypto payment standard
  • AP2's VDC framework provides trust infrastructure for any payment method
  • Reference: github.com/google-agentic-commerce/a2a-x402

Testing with Mock Providers

Development testing without real money:

  • Set up internal environments with mock payment methods
  • Use the official samples as test harnesses (no real payment dependencies)
  • Mock Credentials Provider returns fake DPANs
  • Mock Payment Processor approves without real authorization
  • OTP test value: "123" (from samples)
  • Use "verbose" mode for full mandate payload visibility

Framework Flexibility

AP2 agents can be built with any framework:

  • Google ADK — Reference implementation framework
  • LangGraph — LangChain-based agent graphs
  • CrewAI — Crew-based multi-agent orchestration
  • AG2 — Microsoft's agent framework
  • Custom — Any Python/JS framework with A2A support

The protocol doesn't mandate a specific framework — only A2A compliance.

Multi-Merchant Comparison

Shopping Agents can query multiple merchants:

  1. Send Intent Mandate to Merchant A, B, C in parallel
  2. Receive Checkout Mandates from each
  3. Compare offers (price, shipping, availability)
  4. Present best options to user
  5. User selects preferred offer
  6. Proceed with selected merchant

Subscription and Recurring Payments

On the V1.x roadmap:

  • Standardized recurring payment flows
  • Subscription management
  • Recurring Intent Mandates with TTL-based reauthorization

Production Deployment Considerations

  • Key management — HSMs for merchant signing keys, secure hardware for user keys
  • PCI compliance — Credentials Provider must meet PCI DSS requirements
  • Logging — Complete audit trail for all mandates and transactions
  • Monitoring — Track mandate creation, signing, and payment success rates
  • Scaling — Each agent role scales independently
  • Trust establishment — Start with allowlists, evolve to certificate-based trust

Security Checklist

  • Shopping Agent cannot access raw payment credentials
  • User signatures are hardware-backed
  • Merchant signatures are entity-level (not agent-level)
  • All mandates are stored with signatures for audit
  • Challenge flows redirect to trusted surfaces
  • Risk signals are captured at transaction time
  • PCI data stays within Credentials Provider boundary
  • Agent-to-agent communication is encrypted (HTTPS)

Best Practices

  • Start with the official samples as a foundation
  • Use mocked payment providers for development
  • Test the full multi-agent flow end-to-end
  • Implement proper role separation from the beginning
  • Build with the UCP integration pattern for full commerce flows
  • Monitor the AP2 roadmap for new capabilities (push payments, subscriptions)
  • Follow Google ADK patterns for the reference implementation approach
  • Engage with the AP2 community on GitHub for updates

Fetch the latest specification, roadmap, and sample implementations for current capabilities and patterns before implementing.

Frequently asked questions

What does the Ap2 Dev Patterns AI skill do?

Apply AP2 cross-cutting development patterns — multi-agent payment architecture, UCP integration, x402 crypto payments, testing with mock providers, and production deployment. Use when architecting agentic payment systems or solving cross-cutting payment concerns.

Why use Ap2 Dev Patterns on TypingMind?

Because you install it once and use it with any model. Ap2 Dev Patterns is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ap2 Dev Patterns in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/ap2-agentic-payments/skills/ap2-dev-patterns. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Ap2 Dev Patterns?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ap2 Dev Patterns?

As many as you like. As long as a model supports skills, you can use Ap2 Dev Patterns with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ap2 Dev Patterns AI skill free?

Yes. It is published on GitHub by OrcaQubits under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇