adk-payments
Protocol-neutral agentic commerce and payment orchestration for ADK-Rust.
adk-payments gives you one canonical commerce kernel and durable transaction
journal that can sit behind multiple protocol adapters. It is built for cases
where an agent needs to create, update, authorize, complete, and follow up on
real commerce transactions without leaking raw payment artifacts into normal
conversation state.
Overview
Use adk-payments when you need to:
- expose merchant checkout or delegated-payment APIs over ACP
- handle AP2 mandate-based shopper flows with explicit authorization artifacts
- keep one canonical transaction record even when ACP and AP2 are both enabled
- store raw mandates, signatures, tokens, and receipts as evidence instead of transcript text
- preserve transaction continuity after context compaction through durable journal state plus masked memory
The crate combines:
- a canonical commerce domain model in
domain - backend-facing kernel service traits in
kernel - a durable journal + evidence layer in
journal - protocol adapters in
protocol::acpandprotocol::ap2 - agent-facing payment tools in
tools - server wiring helpers in
server
Which Protocol Should I Use?
- Start with ACP stable if you want merchant-hosted HTTP checkout routes and delegated payment support.
- Use ACP experimental only when you need the evolving discovery, delegate-authentication, or webhook extensions and can tolerate draft churn.
- Use AP2 if your flow is mandate-based and involves multiple commerce actors such as shopper, merchant, credentials-provider, and payment-processor.
- Run both ACP and AP2 if you need standards compatibility on multiple fronts but want one backend transaction model.
Protocol Support
| Feature | Status | What it enables |
|---|---|---|
acp |
Stable baseline | ACP 2026-01-30 checkout routes, delegated payment, completion, cancelation, status |
acp-experimental |
Draft / feature-gated | ACP discovery, delegate-authentication, signed webhooks |
ap2 |
Alpha baseline | AP2 v0.1-alpha mandates, payment execution, receipts, interventions |
ap2-a2a |
Additive | AP2 A2A-oriented helpers and AgentCard metadata |
ap2-mcp |
Additive | AP2 MCP-safe continuation, intervention, and receipt views |
ACP stable is the conservative production baseline. AP2 support tracks the current alpha research draft. The experimental ACP surface is intentionally feature-gated because the wire format is still moving.
Installation
Choose only the features you need:
[]
= { = "0.6.0", = ["acp"] }
[]
= { = "0.6.0", = ["ap2", "ap2-a2a", "ap2-mcp"] }
[]
= { = "0.6.0", = ["acp", "acp-experimental", "ap2"] }
Core Concepts
Canonical Transaction
ACP sessions, ACP orders, AP2 mandates, and AP2 receipts all correlate to one
internal TransactionId. Protocol IDs are preserved in ProtocolRefs; they
are not treated as interchangeable.
Durable Journal
The transaction journal stores canonical commerce state in adk-session. Safe,
masked transaction summaries are indexed into adk-memory. Raw sensitive
payloads live in adk-artifact through the evidence store.
Evidence First
Raw payment credentials, merchant signatures, user authorizations, mandate payloads, and receipt bodies are preserved as immutable evidence artifacts. Only safe summary metadata is kept in transcript-visible and memory-visible surfaces.
Kernel-Mediated Compatibility
ACP and AP2 can share a backend, but adk-payments does not pretend their
artifacts are semantically equivalent. When a direct ACP-to-AP2 or AP2-to-ACP
conversion would lose provenance or authorization semantics, the kernel returns
an explicit unsupported error instead of fabricating a translation.
Typical Architecture
Agent / Tool / Server surface
|
v
ACP router or AP2 adapter
|
v
Canonical commerce kernel traits
|
+--> transaction journal (adk-session)
+--> evidence store (adk-artifact)
+--> masked recall index (adk-memory)
+--> auth + guardrail enforcement
Quick Start
1. Expose ACP Checkout Routes
use Arc;
use ;
use ;
let router = new
.with_merchant_checkout_service
.with_delegated_payment_service
.with_verification
.build?;
Use this route surface when you want HTTP endpoints for checkout session create, update, completion, cancelation, status lookup, and delegated payment.
2. Handle AP2 Mandate Flows
use Ap2Adapter;
let adapter = new
.with_intervention_service;
let record = adapter.submit_cart_mandate.await?;
let payment = adapter.submit_payment_mandate.await?;
let final_record = adapter.apply_payment_receipt.await?;
Use AP2 when your flow is mandate-based and multiple specialized actors participate in authorization and settlement.
3. Register Agent-Facing Payment Tools
use PaymentToolsetBuilder;
let toolset = new
.with_intervention_service
.build;
let tools = toolset.tools;
These tools return masked transaction summaries only. Raw card data, signatures, and authorization blobs do not appear in tool outputs.
Primary Journeys
The crate is currently shaped around five first-class journeys:
- ACP human-present checkout with delegated payment and post-order updates
- AP2 human-present shopper, merchant, credentials-provider, and payment-processor flow
- AP2 human-not-present intent flow with either autonomous completion or forced return-to-user intervention
- dual-protocol backends serving ACP and AP2 against one canonical transaction journal
- post-compaction recall where durable transaction state survives loss of conversational detail
Security Model
- Raw payment credentials, merchant signatures, user authorizations, and receipt artifacts are stored as evidence.
- Session state and semantic memory retain only masked transaction summaries.
adk-authbinds requests to session identity and audit metadata.adk-guardrailenforces amount, merchant, intervention, and protocol-policy checks before persistence.- The kernel refuses lossy protocol-to-protocol conversions rather than approximating semantics.
Validation and Examples
The integration tests are the authoritative executable reference path:
Use these as the starting point for real implementations:
adk-payments/tests/acp_integration_tests.rsadk-payments/tests/ap2_integration_tests.rsadk-payments/tests/cross_protocol_correlation_tests.rsexamples/payments/docs/official_docs/security/payments.md
Related Modules
domain- canonical commerce typeskernel- protocol-neutral commands, service traits, correlation, and errorsjournal- durable transaction and evidence persistenceprotocol::acp- ACP server and verification surfacesprotocol::ap2- AP2 adapter, verification, A2A, and MCP surfacestools- agent-facing checkout, status, and intervention toolsserver- ACP router re-exports and AP2 integration notes