How to Implement ACP
Complete step-by-step guide to integrating the Agentic Commerce Protocol into your e-commerce platform and reaching AI shopping assistants.
Prerequisites
Before implementing ACP, ensure you have:
Existing E-Commerce Platform
A functioning online store with product catalogue, inventory management, and order processing.
Stripe Account
An active Stripe account for payment processing. ACP was designed with Stripe integration in mind.
HTTPS-Enabled Server
All ACP communications must occur over HTTPS. Ensure your server has a valid SSL certificate.
Development Resources
Backend developers familiar with REST APIs, authentication, and payment processing.
Testing Environment
A staging server to test your ACP implementation before going live.
Implementation Steps
Design Your ACP Endpoints
Create four core REST API endpoints that AI agents will call:
- •POST /acp/checkout - Create a new checkout session
- •PATCH /acp/checkout/:id - Update checkout with user selections
- •POST /acp/checkout/:id/complete - Complete purchase with payment token
- •DELETE /acp/checkout/:id - Cancel an in-progress checkout
Implement Checkout Creation
When an agent calls your Create Checkout endpoint:
- •Accept product IDs or search criteria from the agent
- •Return structured cart data including product details, pricing, and images
- •Include available shipping methods and estimated delivery times
- •Generate a unique checkout session ID
- •Return supported payment methods
Handle Checkout Updates
Allow agents to modify the checkout based on user preferences:
- •Accept quantity changes, product additions/removals
- •Update shipping method selections
- •Recalculate totals including tax and shipping
- •Validate inventory availability in real-time
- •Return updated checkout state
Integrate SharedPaymentToken
Securely process payments using ACP's token system:
- •Accept the SharedPaymentToken from the agent
- •Exchange the token with Stripe for a payment method
- •Create a Stripe PaymentIntent with the payment method
- •Confirm the payment through Stripe's API
- •Handle payment success/failure appropriately
Implement Order Completion
Finalize the transaction and create the order:
- •Create order record in your database
- •Send order confirmation to customer
- •Update inventory to reflect purchase
- •Return order details and tracking information to agent
- •Trigger fulfilment workflow
Add Authentication & Security
Secure your ACP endpoints:
- •Implement Bearer token authentication
- •Add HMAC signature verification for webhooks
- •Validate all incoming requests
- •Rate limit API calls to prevent abuse
- •Log all transactions for audit purposes
Test Your Implementation
Thoroughly test before going live:
- •Use ACP test mode with sample transactions
- •Test all checkout flows (single product, multiple products, updates)
- •Verify payment processing with Stripe test cards
- •Test error scenarios (out of stock, payment failure)
- •Ensure webhook events are properly handled
Register Your Business
Make your ACP implementation discoverable:
- •Apply to OpenAI's commerce program
- •List your business in agent commerce directories
- •Provide your ACP endpoint URLs to AI platforms
- •Configure which products are available to agents
- •Set up monitoring and analytics
Best Practices
Provide Rich Product Data
Include detailed descriptions, multiple images, specifications, and reviews to help AI agents make informed recommendations.
Optimise Response Times
Agents expect fast responses. Aim for sub-500ms API response times to provide smooth user experiences.
Handle Errors Gracefully
Return clear, structured error messages that agents can parse and present to users in natural language.
Keep Inventory Updated
Real-time inventory checks prevent overselling and ensure agents only present available products.
Monitor Agent Behaviour
Track which agents are accessing your API, conversion rates, and common failure points to optimise your integration.
Support Webhooks
Implement webhook receivers so agents can be notified of order status changes and delivery updates.
Common Implementation Challenges
Challenge: Payment Token Exchange
Solution: Work closely with Stripe's documentation on handling SharedPaymentTokens. Use their test mode extensively before going live.
Challenge: Inventory Synchronisation
Solution: Implement webhook listeners to receive real-time inventory updates, or use short cache TTLs to ensure freshness.
Challenge: Authentication Setup
Solution: Generate unique API keys for each AI platform and implement proper Bearer token validation with rate limiting.
Challenge: Handling Concurrent Requests
Solution: Use database row-level locking for inventory checks and implement idempotency keys for payment operations.
Official Resources
Ready to List Your ACP-Enabled Business?
Once you've implemented ACP, list your business in the Agent Commerce Directory to get discovered by AI shopping platforms.
List Your Business Free →