Overview
Agentic Commerce Protocol (ACP) enables ChatGPT and other OpenAI-powered agents to initiate and complete purchases through tool calls. This guide walks you through implementing ACP tools.
Prerequisites
Before starting, ensure you have:
- OpenAI API access
- Ability to create API endpoints
- Product catalog data
- Payment processing setup
- Understanding of OpenAI function calling
Quick Start Guide
Create tool definitions that ChatGPT can invoke:
{
"type": "function",
"function": {
"name": "search_products",
"description": "Search for products in the catalog",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query"
}
}
}
}
}
Create API endpoints that handle tool invocations:
POST /acp/tools/search_products
{
"query": "running shoes"
}
Response:
{
"products": [
{
"id": "prod_123",
"name": "Running Shoes",
"price": 129.99
}
]
}
Step 3: Enable Instant Checkout
Implement checkout tools that ChatGPT can call:
{
"type": "function",
"function": {
"name": "initiate_checkout",
"description": "Initiate checkout for selected products",
"parameters": {
"type": "object",
"properties": {
"product_id": {
"type": "string"
},
"quantity": {
"type": "number"
}
}
}
}
}
Use OpenAI's function calling API to register your ACP tools.
When ChatGPT calls your tools, process the request and return structured responses.
3. Enable Checkout
Implement checkout tools that complete purchases within conversations.
Testing Your Implementation
- Start a ChatGPT conversation
- Ask ChatGPT to search for products
- Verify ChatGPT calls your tool
- Confirm responses are correct
Test Checkout Flow
- Ask ChatGPT to purchase a product
- Verify checkout tool is called
- Confirm purchase completes
- Verify order confirmation
Next Steps