- Published on
How to Build an Agentic Commerce Protocol Integration (ChatGPT Instant Checkout)
- Authors
- Name
- Tom Hacohen
- @TomHacohen
Svix powers the webhook infrastructure for startups and the Fortune 500. Developers make one API call, and Svix takes care of reliability, scale, retries, security, and more. Start sending for free!
OpenAI made a big announcement earlier this week ChatGPT Instant Checkout, and the related Agentic Commerce Protocol (ACP). It is essentially a new standard that enables agents (like ChatGPT) to complete purchases on behalf of users directly with merchants.
A key design goal of ACP is to allow merchants to keep their customer relationship. The customers buy from the merchants directly, the payment goes directly to the merchant, the merchant decides whether to accept or decline an order, and the merchants handle the full post-purchase experience.
I believe ACP has huge potential, so I decided to write an introduction to how it works, and how to build an integration.
Just to give it some color, here is an example of an Etsy purchase happening from within the ChatGPT app:
Why I'm excited about ACP
I've had two recent experiences that make me believe this has the potential of being huge: the first one was seeing the woman next to me on the plane asking ChatGPT how to get to her hotel, and the second was selling an old laptop and having the other person say "I asked ChatGPT and it said $500 is a fair price".
These two experiences demonstrate how people use ChatGPT for literally everything. If you're already asking ChatGPT for help with booking a holiday or choosing which vacuum cleaner to buy, it also makes sense to ask it to find you the best deal and actually book it for you.
Additionally, we've taken a keen interest in this since ACP includes webhooks as a core part of the workflow, and we want to make sure we best serve our customers when they add support for it. We've already heard from several of our customers that they have ACP on their radar, and we also support some of the official ChatGPT Instant Checkout launch partners with their webhooks.
Building an ACP integration
ACP has three separate but related flows: product discovery, checkout flow, and handling payments. They are responsible for enabling the agent to discover products, handling the checkout (buying) flow, and the handling of payments.
We will now dive deeper into each one of them.
Product discovery phase
The product discovery phase (officially: Product Feed Spec) defines how merchants share structured product data with the agent, so that the agent can surface the products in search and shopping experiences.
This part is fairly straightforward, you need to export your product list to the format specified in the aforementioned Product Feed Spec. Once you have that export ready, you can send it to OpenAI (or other agent providers) which will then process it.
This step is a bit less dynamic than the rest of the spec, which I found a bit surprising. I'd have expected some CRUD endpoint to bulk send updates, or better yet, a way to send webhooks like they did in the checkout flow. I'm sure this will evolve as the spec evolves.
Agentic checkout
ChatGPT can then use the products surfaced from the feed to show customers relevant products. Once the customer decides which product to buy, they can tell the agent to go ahead and buy it. That part involves the Agentic Checkout phase, which is a way to implement end-to-end checkout flows inside the chat interface while keeping orders, payments, and compliance on the merchant's existing commerce stack.
This is the most integration heavy step in the process and requires a multiple API endpoints as well as webhooks.
The idea here is to give ChatGPT full information about the lifecycle of the order. I assume this is related to the recent release of ChatGPT Pulse. They want the agent to be fully aware of the status of all the orders in order to better serve customers.
This part of the integration requires that you have pre-defined API endpoints on your end to manage "checkout sessions" under /checkout_sessions
, as well as two webhooks: order_created
and order_updated
.
Once those are created, the flow looks something like this:
- A customer is presented products using the aforementioned Product Feed.
- The customer then decides to potentially buy an item, which is started by ChatGPT making a "create checkout session" API call to your service which includes cart contents and some additional context on the buyer.
- As the customer chooses different items, ChatGPT may make "update session" calls to your service.
- ChatGPT will then call "complete checkout" to complete the checkout.
- At any point, ChatGPT may call "cancel checkout" to cancel the checkout.
- Merchant is expected to send webhook for order lifecycle events (
order_created
andorder_updated
) to make sure ChatGPT stays up to date on the order status.
The APIs are just normal APIs, though ACP does require support for a few additional headers that many APIs may not have by default (request-id and idempotency). You can refer to the spec for the exact details.
As for the webhooks, you can use Svix to send the webhooks (checkout the Svix quickstart guide). We are going to add easy ways to create ACP webhooks, but until then, you can refer to the official ACP OpenAPI spec for more information.
Once the checkout process is done, it's time for payment. Which it seems can either use existing payment methods saved with the merchant, or using the Delegated Payments Spec, which we'll cover in the next section.
Delegated payment
The last step is to actually make a payment. This flow enables the agent to make a payment on behalf of the customer (officially: Delegated Payment Spec). This is probably out of scope for most people, as it's expected that the payment provider (e.g. Stripe) would implement it and merchants would use that.
Additionally, having read the spec a few times, it's not fully clear to me whether this is required or not. Some sections make it feel like it is, some make it feel like the payment can just be handled with saved credentials on the merchants end. If I had to guess: it probably can use either.
Either way, given it's something only the payment providers (like Stripe) need to implement we won't cover this as part of this scope.
Closing words
At the moment only ChatGPT supports it, but I expect more agent companies to follow suit soon. In order to get added to ChatGPT you need to register as a merchant which feels like a manual process at the moment but will probably become more self-serve as usage grows.
As I said, I believe ACP has huge potential and we plan on making it even easier to support ACP using Svix. We already released a Svix ACP connector, and plan on releasing ACP helper libraries and more things in the very near future.
If you're already building against ACP, or have any thoughts about it, I'd love to hear more. So please contact us and I'll make sure to personally read all of the ACP related messages.
For more content like this, make sure to follow us on Twitter, Github, RSS, or our newsletter for the latest updates for the Svix webhook service, or join the discussion on our community Slack.