ap2-payment-processor
Build an AP2 Merchant Payment Processor — the agent that constructs payment authorization messages, requests credentials from the Credentials Provider, processes payments, and returns receipts. Use when implementing the MPP role.
Best use case
ap2-payment-processor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Build an AP2 Merchant Payment Processor — the agent that constructs payment authorization messages, requests credentials from the Credentials Provider, processes payments, and returns receipts. Use when implementing the MPP role.
Teams using ap2-payment-processor 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
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/ap2-payment-processor/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How ap2-payment-processor Compares
| Feature / Agent | ap2-payment-processor | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Build an AP2 Merchant Payment Processor — the agent that constructs payment authorization messages, requests credentials from the Credentials Provider, processes payments, and returns receipts. Use when implementing the MPP role.
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
# AP2 Merchant Payment Processor Implementation
## Before writing code
**Fetch live docs**:
1. Fetch `https://ap2-protocol.org/specification/` for Payment Processor responsibilities
2. Web-search `site:github.com google-agentic-commerce AP2 samples roles merchant_payment_processor` for reference implementation
3. Web-search `site:github.com google-agentic-commerce AP2 payment processor authorization` for authorization flow
4. Fetch `https://ap2-protocol.org/topics/core-concepts/` for MPP role details
## Conceptual Architecture
### What the Payment Processor Does
The Merchant Payment Processor (MPP) **handles the financial side** of the transaction on behalf of the merchant:
1. **Receives payment requests** from the Merchant Agent
2. **Requests credentials** from the Credentials Provider using the Payment Mandate
3. **Constructs authorization messages** for the payment network
4. **Processes the payment** through the network/issuer
5. **Handles challenges** (3DS2, OTP) when required
6. **Returns receipts** to the Merchant Agent
### Where It Sits in the Flow
```
Shopping Agent → Merchant Agent → MPP → Credentials Provider
↓
Payment Network / Issuer
↓
Authorization Result
↓
MPP → Merchant Agent → Shopping Agent → User
```
### Key Responsibilities
#### Payment Authorization
- Receive the Payment Mandate from the Merchant Agent
- Present the mandate to the Credentials Provider
- Receive tokenized/resolved credentials
- Construct network authorization message
- Submit to the payment network for authorization
- Handle authorization response (approved, declined, challenged)
#### Challenge Handling
When the network/issuer requires additional verification:
- **3DS2** — Strong customer authentication challenge
- **OTP** — One-time password verification
- The MPP triggers a redirect to a trusted user surface
- User completes the challenge
- MPP retries authorization with challenge response
- V0.1 supports redirect challenges
#### Receipt Generation
After successful authorization:
- Generate a payment receipt with transaction details
- Include authorization code, transaction ID
- Return receipt to Merchant Agent
- Receipt flows through to Shopping Agent and ultimately to user
### Payment Network Integration
The MPP interfaces with traditional payment infrastructure:
- **Card networks** — Visa, Mastercard, etc.
- **Payment gateways** — Stripe, Adyen, etc.
- **Issuing banks** — For authorization and settlement
- The Payment Mandate provides these entities visibility into the agentic nature of the transaction
### Risk Signals
The MPP may add risk signals to the authorization:
- Agent identity information
- Transaction context (human-present/not-present)
- Mandate verification results
- Risk payload from the Payment Mandate
### OTP Challenge Flow (Reference)
From the sample implementation:
1. MPP receives payment request from Merchant
2. MPP determines OTP is required
3. MPP sends challenge to Shopping Agent (via A2A)
4. Shopping Agent presents challenge to user
5. User enters OTP (test value: "123" in samples)
6. Shopping Agent returns OTP to MPP
7. MPP verifies OTP
8. MPP proceeds with payment authorization
### Best Practices
- Always validate the Payment Mandate before requesting credentials
- Handle all authorization responses (approved, declined, challenged)
- Implement proper retry logic for transient network failures
- Support multiple challenge types (3DS2, OTP)
- Generate detailed receipts for audit trail
- Log all payment attempts with outcomes
- Handle partial authorizations appropriately
- Implement idempotency for payment processing
Fetch the specification for exact MPP requirements, authorization message format, and challenge flow details before implementing.Related Skills
woo-payments
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.
ucp-payment-handlers
Implement UCP payment handlers — configure Google Pay, Shop Pay, or custom payment methods with tokenization, credential flow, and instrument schemas. Use when integrating payment processing into a UCP checkout.
spree-payments
Integrate payment gateways with Spree — PaymentMethod model, the v5.4+ PaymentSession provider-agnostic checkout flow, Stripe via `spree_stripe` (Apple/Google Pay, Link, Connect for marketplaces), Adyen via `spree_adyen`, PayPal via `spree_paypal_checkout`, StoreCredit / GiftCard as payment methods, refunds, payment state machine, and authoring a custom gateway. Use when wiring a payment integration, handling webhooks from a gateway, or debugging payment-state issues.
sf-payments
Implement Salesforce Commerce payments — Salesforce Payments (supports multiple processors including Stripe and Adyen), B2C payment adapters (JavaScript cartridge-based), B2B payment adapters (Apex-based), PCI compliance via tokenization, 3D Secure/SCA support, and payment method management. Use when implementing payment processing.
saleor-payments
Implement Saleor payment processing — transaction-based payment flow, payment Apps, sync webhook events, Stripe/Adyen patterns, and refunds. Use when building payment integrations.
medusa-payments
Implement Medusa v2 payment processing — payment module, provider abstraction, payment sessions, authorization/capture/refund lifecycle, and Stripe/PayPal integration. Use when adding payment providers.
bc-payments
Integrate BigCommerce payments — Payment Processing API, stored payment instruments, payment methods, server-side payment processing for headless, and PCI considerations. Use when building custom payment flows or processing payments programmatically.
ap2-payment-mandate
Implement the AP2 Payment Mandate — the VDC shared with payment networks and issuers to signal AI involvement and user authorization. Use when building payment authorization flows, tokenization, and network integration.
acp-payment-handlers
Implement ACP payment handlers — pluggable payment method specifications including tokenized cards, seller-backed methods (gift cards, points, store credit), and handler negotiation. Use when adding payment methods or building custom payment handler support.
acp-delegated-payment
Implement the ACP delegated payment flow and SharedPaymentToken (SPT) provisioning. Use when integrating with Stripe for payment tokenization, handling SPT lifecycle, or building the payment completion flow.
woo-testing
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
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.