| name | agentic-commerce-protocol |
| description | Integrate the Agentic Commerce Protocol (ACP) for AI-driven commerce between buyers, agents, and businesses |
| triggers | ["implement agentic commerce protocol","integrate ACP checkout flow","add AI agent commerce capability","setup agentic commerce API","create ACP payment handler","configure agentic checkout endpoint","implement ACP seller integration","build AI commerce protocol integration"] |
Agentic Commerce Protocol (ACP) Skill
Skill by ara.so — AI Agent Skills collection.
Overview
The Agentic Commerce Protocol (ACP) is an open standard for connecting buyers, their AI agents, and businesses to complete purchases seamlessly. Maintained by OpenAI and Stripe, ACP enables AI agents to initiate and complete commerce transactions on behalf of users.
Key Capabilities:
- AI agents can discover and purchase products/services
- Businesses expose checkout endpoints to AI agents
- Payment providers handle secure payment token exchange
- Support for carts, orders, fulfillment, and extensions
- Date-based versioning (
YYYY-MM-DD format)
Current Version: 2026-04-17
Installation & Setup
For Merchants (Implementing Checkout Endpoints)
- Clone the specification repository:
git clone https://github.com/agentic-commerce-protocol/agentic-commerce-protocol.git
cd agentic-commerce-protocol
- Review the OpenAPI specification:
cat spec/2026-04-17/openapi/openapi.agentic_checkout.yaml
- Install dependencies for your implementation:
Node.js/Express example:
npm init -y
npm install express body-parser express-validator
Python/Flask example:
pip install flask flask-cors jsonschema
For AI Agent Developers
Review the specification and integrate with a reference implementation:
Core Concepts
1. Agentic Checkout Flow
The basic checkout flow involves these endpoints:
POST /agentic-checkout/capabilities - Discover seller capabilities
POST /agentic-checkout/create-checkout - Initialize checkout session
POST /agentic-checkout/update-checkout - Update checkout details
POST /agentic-checkout/confirm-checkout - Finalize and confirm purchase
2. Payment Handlers
ACP supports multiple payment handler types:
- Delegate Payment Handler - Agent handles payment collection
- Seller-Backed Payment Handler - Seller collects payment directly
- Payment Link Handler - Redirect to payment page
Implementation Examples
Basic Express.js Seller Implementation
const express = require('express');
const bodyParser = require('body-parser');
const { v4: uuidv4 } = require('uuid');
const app = express();
app.use(bodyParser.json());
const checkoutSessions = new Map();
app.post('/agentic-checkout/capabilities', (req, res) => {
res.json({
version: '2026-04-17',
supported_features: [
'cart',
'orders',
'fulfillment',
'extensions'
],
payment_handlers: [
{
type: 'delegate_payment',
supported_methods: ['card', 'bank_transfer']
}
],
extensions: [
{
type: 'discount',
supported_discount_types: ['percentage', 'fixed_amount']
}
]
});
});
app.post('/agentic-checkout/create-checkout', (req, res) => {
{ items, buyer_info, payment_handler } = req.;
(!items || !.(items) || items. === ) {
res.().({
: {
: ,
:
}
});
}
sessionId = ();
session = {
: sessionId,
: ,
: items.( ({
: item.,
: item.,
: item. || ,
: item.,
: (item. || ) * item.
})),
: buyer_info || {},
payment_handler,
: ().()
};
session. = session..( sum + item., );
session. = session.;
checkoutSessions.(sessionId, session);
res.({
: sessionId,
: ,
: session.,
: session.,
: session.,
: session.
});
});
app.(, {
{ checkout_id, items, buyer_info, shipping_address } = req.;
session = checkoutSessions.(checkout_id);
(!session) {
res.().({
: {
: ,
:
}
});
}
(session. !== ) {
res.().({
: {
: ,
:
}
});
}
(items) {
session. = items.( ({
: item.,
: item.,
: item. || ,
: item.,
: (item. || ) * item.
}));
session. = session..( sum + item., );
session. = session.;
}
(buyer_info) {
session. = { ...session., ...buyer_info };
}
(shipping_address) {
session. = shipping_address;
}
res.({
: session.,
: session.,
: session.,
: session.,
: session.
});
});
app.(, {
{ checkout_id, payment_token } = req.;
session = checkoutSessions.(checkout_id);
(!session) {
res.().({
: {
: ,
:
}
});
}
(session. !== ) {
res.().({
: {
: ,
:
}
});
}
session. = ;
session. = payment_token;
session. = ().();
orderId = ;
session. = orderId;
res.({
: session.,
: ,
: orderId,
: {
: orderId,
: session.,
: session.
}
});
});
app.(, {
.();
});
Python/Flask Seller Implementation
from flask import Flask, request, jsonify
from flask_cors import CORS
import uuid
from datetime import datetime
app = Flask(__name__)
CORS(app)
checkout_sessions = {}
@app.route('/agentic-checkout/capabilities', methods=['POST'])
def capabilities():
return jsonify({
'version': '2026-04-17',
'supported_features': [
'cart',
'orders',
'fulfillment'
],
'payment_handlers': [
{
'type': 'delegate_payment',
'supported_methods': ['card']
}
]
})
@app.route('/agentic-checkout/create-checkout', methods=['POST'])
def create_checkout():
data = request.json
items = data.get('items', [])
if not items:
return jsonify({
'error': {
'type': 'invalid_request',
'message': 'Items are required'
}
}), 400
session_id = str(uuid.uuid4())
processed_items = []
subtotal = 0
item items:
quantity = item.get(, )
unit_price = item.get(, )
total = quantity * unit_price
processed_items.append({
: item.get(),
: item.get(),
: quantity,
: unit_price,
: total
})
subtotal += total
session = {
: session_id,
: ,
: processed_items,
: data.get(, {}),
: data.get(),
: subtotal,
: subtotal,
: datetime.utcnow().isoformat()
}
checkout_sessions[session_id] = session
jsonify({
: session_id,
: ,
: processed_items,
: subtotal,
: subtotal
})
():
data = request.json
checkout_id = data.get()
payment_token = data.get()
session = checkout_sessions.get(checkout_id)
session:
jsonify({
: {
: ,
:
}
}),
session[] != :
jsonify({
: {
: ,
:
}
}),
session[] =
session[] = payment_token
order_id =
session[] = order_id
jsonify({
: checkout_id,
: ,
: order_id,
: {
: order_id,
: session[],
: session[]
}
})
__name__ == :
app.run(port=, debug=)
Capability Negotiation
async function checkSellerCapabilities(sellerUrl) {
const response = await fetch(`${sellerUrl}/agentic-checkout/capabilities`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
});
const capabilities = await response.json();
const requiredFeatures = ['cart', 'orders'];
const hasRequiredFeatures = requiredFeatures.every(feature =>
capabilities.supported_features?.includes(feature)
);
return {
compatible: hasRequiredFeatures,
capabilities
};
}
Extension Support (Discounts)
app.post('/agentic-checkout/update-checkout', (req, res) => {
const { checkout_id, extensions } = req.body;
const session = checkoutSessions.get(checkout_id);
if (!session) {
return res.status(404).json({ error: 'Session not found' });
}
const discountExt = extensions?.find(ext => ext.type === 'discount');
if (discountExt) {
const { discount_type, value, code } = discountExt;
if (code === 'SAVE10') {
if (discount_type === 'percentage') {
session.discount = session.subtotal * (value / 100);
} else if (discount_type === 'fixed_amount') {
session.discount = value;
}
session.total = session.subtotal - session.discount;
}
}
res.json({
checkout_id: session.id,
subtotal: session.subtotal,
discount: session. || ,
: session.
});
});
Order Management
app.post('/agentic-checkout/get-order', (req, res) => {
const { order_id } = req.body;
const session = Array.from(checkoutSessions.values())
.find(s => s.order_id === order_id);
if (!session) {
return res.status(404).json({
error: {
type: 'order_not_found',
message: 'Order not found'
}
});
}
res.json({
order_id: session.order_id,
status: session.status,
created_at: session.created_at,
items: session.items,
total: session.total,
fulfillment: {
status: 'pending',
tracking_number: null
}
});
});
Configuration
Environment Variables
PORT=3000
NODE_ENV=production
PAYMENT_PROCESSOR_API_KEY=your_payment_api_key
PAYMENT_PROCESSOR_SECRET=your_payment_secret
WEBHOOK_SECRET=your_webhook_secret
ALLOWED_ORIGINS=https://agent1.example.com,https://agent2.example.com
DATABASE_URL=postgresql://user:password@localhost:5432/acp_db
ACP_VERSION=2026-04-17
Configuration File Example
module.exports = {
version: process.env.ACP_VERSION || '2026-04-17',
features: {
cart: true,
orders: true,
fulfillment: true,
extensions: true,
authentication: false
},
paymentHandlers: [
{
type: 'delegate_payment',
methods: ['card', 'bank_transfer'],
processor: 'stripe'
}
],
extensions: [
{
type: 'discount',
supportedTypes: ['percentage', 'fixed_amount', 'code']
}
],
security: {
requireAuth: false,
allowedOrigins: process.env.ALLOWED_ORIGINS?.split(',') || [],
webhookSecret: process.env.WEBHOOK_SECRET
}
};
Common Patterns
1. Idempotent Request Handling
const processedRequests = new Map();
app.post('/agentic-checkout/confirm-checkout', (req, res) => {
const idempotencyKey = req.headers['idempotency-key'];
if (idempotencyKey && processedRequests.has(idempotencyKey)) {
return res.json(processedRequests.get(idempotencyKey));
}
const result = processCheckout(req.body);
if (idempotencyKey) {
processedRequests.set(idempotencyKey, result);
}
res.json(result);
});
2. Webhook Event Handling
app.post('/webhooks/acp', (req, res) => {
const signature = req.headers['x-acp-signature'];
if (!verifyWebhookSignature(req.body, signature)) {
return res.status(401).json({ error: 'Invalid signature' });
}
const event = req.body;
switch (event.type) {
case 'checkout.completed':
handleCheckoutCompleted(event.data);
break;
case 'checkout.cancelled':
handleCheckoutCancelled(event.data);
break;
case 'order.fulfilled':
handleOrderFulfilled(event.data);
break;
}
res.json({ received: true });
});
3. Error Handling
function sendError(res, type, message, statusCode = 400) {
res.status(statusCode).json({
error: {
type,
message,
timestamp: new Date().toISOString()
}
});
}
app.post('/agentic-checkout/create-checkout', (req, res) => {
try {
const { items } = req.body;
if (!items || items.length === 0) {
return sendError(res, 'invalid_request', 'Items are required');
}
} catch (error) {
console.error('Checkout error:', error);
sendError(res, 'internal_error', 'An error occurred', 500);
}
});
4. Cart Management
app.post('/agentic-checkout/add-to-cart', (req, res) => {
const { checkout_id, item } = req.body;
const session = checkoutSessions.get(checkout_id);
if (!session) {
return sendError(res, 'checkout_not_found', 'Session not found', 404);
}
const existingIndex = session.items.findIndex(i => i.id === item.id);
if (existingIndex >= 0) {
session.items[existingIndex].quantity += item.quantity || 1;
} else {
session.items.push({
id: item.id,
name: item.name,
quantity: item.quantity || 1,
unit_price: item.unit_price,
total: (item.quantity || 1) * item.unit_price
});
}
session.subtotal = session.items.reduce(() => sum + i., );
session. = session. - (session. || );
res.({
: session.,
: session.,
: session.,
: session.
});
});
Testing
Test Suite Example
const request = require('supertest');
const app = require('./server');
describe('ACP Checkout Flow', () => {
let checkoutId;
test('GET capabilities', async () => {
const res = await request(app)
.post('/agentic-checkout/capabilities')
.expect(200);
expect(res.body.version).toBe('2026-04-17');
expect(res.body.supported_features).toContain('cart');
});
test('POST create-checkout', async () => {
const res = await request(app)
.post('/agentic-checkout/create-checkout')
.send({
items: [
{
id: 'prod_123',
name: 'Test Product',
quantity: 2,
unit_price: 1000
}
],
payment_handler: {
:
}
})
.();
checkoutId = res..;
(res..).();
(res..).();
});
(, () => {
res = (app)
.()
.({
: checkoutId,
:
})
.();
(res..).();
(res..).();
});
});
Troubleshooting
Common Issues
1. Invalid version error
Error: Unsupported ACP version
Solution: Ensure your implementation supports the version specified in the request. Check spec/2026-04-17/ for the current stable version.
2. Payment handler mismatch
Error: Unsupported payment handler type
Solution: Verify the payment handler type in your capabilities response matches what the agent is requesting.
3. Checkout session not found
Error: checkout_not_found
Solution: Implement proper session storage (Redis, database) instead of in-memory maps for production. Sessions should persist across server restarts.
4. CORS errors
Access-Control-Allow-Origin header missing
Solution: Add CORS middleware with appropriate allowed origins:
const cors = require('cors');
app.use(cors({
origin: process.env.ALLOWED_ORIGINS.split(','),
credentials: true
}));
5. Idempotency issues
Duplicate checkout created
Solution: Implement idempotency key handling for all mutating operations.
Validation
Use the JSON schemas provided in the spec for validation:
const Ajv = require('ajv');
const ajv = new Ajv();
const checkoutSchema = require('./spec/2026-04-17/json-schema/checkout.schema.json');
const validate = ajv.compile(checkoutSchema);
app.post('/agentic-checkout/create-checkout', (req, res) => {
const valid = validate(req.body);
if (!valid) {
return res.status(400).json({
error: {
type: 'validation_error',
message: validate.errors
}
});
}
});
Additional Resources
- Official Documentation: https://agenticcommerce.dev
- OpenAPI Spec:
spec/2026-04-17/openapi/openapi.agentic_checkout.yaml
- Examples:
examples/2026-04-17/
- Governance:
docs/governance.md
- Contributing:
CONTRIBUTING.md