# Accept a payment via ChatGPT Checkout.com's integration with OpenAI's Agentic Commerce Protocol (ACP) enables your customers to complete purchases for products they've discovered through ChatGPT's AI-powered chat interface. Payment requests are handled entirely by Checkout.com. The card details pass directly between your customer and Checkout.com via ChatGPT, and do not reach your servers. > **Information** > > You can only request card payments with the agentic commerce integration. Alternative payment methods (APMs) are not supported. --- ## Before you start You need: - A [test account](https://www.checkout.com/get-test-account) with Checkout.com. - The `agentic-commerce:delegated-payment` scope enabled on your account. Contact your account manager to enable it, then create a [secret key](https://www.checkout.com/docs/resources/api-authentication/api-keys.md) with this scope. - Your client ID registered in the Agentic Commerce Protocol. Contact your account manager to complete this step. - Your processing channel ID. - Your client ID. - A ChatGPT account with a Plus plan or higher. --- ## How it works 1. The customer starts a conversation in your ChatGPT plugin and browses or selects a product. 2. ChatGPT calls your MCP server's product tool to retrieve available items from your catalog. 3. The customer selects a product and taps _Buy_, confirming their shipping address. 4. ChatGPT calls your `create_checkout_session` tool. Your MCP server creates the checkout session in your backend and returns delivery options to ChatGPT. The response includes your Checkout.com client ID (`cli_xxx`) in the `payment_provider` object. 5. ChatGPT renders the delivery options to the customer, who selects one. 6. ChatGPT sends the selection to your MCP server to calculate sales tax and the final price. 7. Your MCP server returns the total to ChatGPT, which renders the final amount to the customer. 8. The customer reviews the total and confirms with "Pay". ChatGPT collects their card details and calls Checkout.com's delegated token endpoint to generate a payment token (`tok_xxx`). 9. ChatGPT gathers the payment token, order details, and integrity signals, and sends them to your `complete_checkout_session` tool. 10. Your MCP server calls the Checkout.com Payments API with `source.type: "token"` to process the payment. Checkout.com accepts or declines the order. 11. Checkout.com processes the payment and returns the result. Your server confirms the order to the customer through ChatGPT, and all parties receive confirmation. ![Diagram of the purchase process when using agentic commerce with ChatGPT, showing the communication between your customer, your ChatGPT plugin, your MCP server, and the Checkout.com server.](https://www.checkout.com/docs/NAS/Flow/agentic_commerce_acp_flow.png) --- ## Build your ChatGPT plugin Build a ChatGPT plugin using the [OpenAI Apps SDK](https://developers.openai.com/apps-sdk). A ChatGPT plugin consists of an MCP server that exposes tools to ChatGPT, and an optional UI component rendered in an iframe. ### Set up your MCP server OpenAI's official MCP SDK is the quickest way to get started: **TypeScript** ```bash npm install @modelcontextprotocol/sdk @modelcontextprotocol/ext-apps zod ``` **Python** ```bash pip install mcp ``` Your MCP server must: - Advertise tools with JSON schema input and output contracts. - Include [tool annotations](https://developers.openai.com/apps-sdk) for each tool: - Set `readOnlyHint` to `true` for read-only tools such as `list_products` and `get_checkout_session`. - Set `destructiveHint` to `true` for tools with irreversible side effects. - Set `openWorldHint` to `false` for tools that affect only a bounded target. - Use Streamable HTTP or Server-Sent Events (SSE) transport. ### Connect your plugin to ChatGPT Ensure your MCP server is reachable over HTTPS. For local development, use a tunneling tool such as ngrok or Cloudflare Tunnel. 1. In ChatGPT, go to _Settings_ > _Advanced settings_, and enable developer mode. 2. Go to _Connectors_ > _Create_, and provide your connector name, description, and the public `/mcp` endpoint URL. 3. Select _Create_. If the connection is successful, ChatGPT lists the tools your server advertises. > **Note** > > For production plugins, you must [submit your plugin to OpenAI](https://chatgpt.com/merchants) for approval before accepting live payments. This is not required for your test plugin. > **Information** > > OpenAI requires ChatGPT plugins to use external checkout, directing customers to complete purchases on your own domain. Instant Checkout within ChatGPT is currently only available to select marketplace partners. --- ## Implement the Agentic Commerce Protocol Extend your ChatGPT plugin by implementing the ACP checkout session request types in your MCP server. Checkout.com recommends you implement all request types to handle the full range of customer interactions. | Request Type | Endpoint | Description | | --- | --- | --- | | Create a checkout session | `POST /checkout_sessions` | Initialize a new checkout with items and customer information | | Retrieve a checkout session | `GET /checkout_sessions/{id}` | Get the current state of an existing checkout | | Update a checkout session | `POST /checkout_sessions/{id}` | Modify items, delivery options, or customer details | | Complete a checkout session | `POST /checkout_sessions/{id}/complete` | Finalize the checkout and process payment | | Cancel a checkout session | `POST /checkout_sessions/{id}/cancel` | Cancel an active checkout session | For the full ACP specification, see [OpenAI's Agentic Commerce Protocol documentation](https://developers.openai.com/commerce). ### Create a checkout session When the customer selects a product, ChatGPT calls your `create_checkout_session` tool with the selected items: ```json { "items": [ { "id": "prod_001", "quantity": 1 } ] } ``` Create the checkout session in your backend and return the session details to ChatGPT. Include the `checkoutRequest` object in the `structuredContent` of your tool response, with your Checkout.com client ID in the `payment_provider.merchant_id` field: ### Request example ```json { "content": [ { "type": "text", "text": "Checkout session created!\nSession ID: cs_1776170582038\nStatus: ready_for_confirmation\nTotal: $29.99 USD" } ], "structuredContent": { "type": "checkout_session", "session": { "id": "cs_1776170582038", "object": "checkout_session", "status": "ready_for_confirmation", "amount_total": 2999, "currency": "usd", "line_items": [ { "id": "prod_001", "name": "Signal Cap", "quantity": 1, "unit_price": 2999, "total": 2999 } ], "payment_methods": ["card"], "created_at": "2026-04-14T12:43:02.038Z" }, "checkoutRequest": { "id": "cs_1776170582038", "payment_provider": { "provider": "checkout", "merchant_id": "cli_fx6zuwfrky3e7gy63ia2y3vdse", "supported_payment_methods": ["card"] }, "status": "ready_for_payment", "currency": "USD", "line_items": [ { "id": "prod_001", "item": { "id": "prod_001", "quantity": 1 }, "base_amount": 2999, "discount": 0, "subtotal": 2999, "tax": 0, "total": 2999 } ], "totals": [ { "type": "subtotal", "display_text": "Subtotal", "amount": 2999 }, { "type": "total", "display_text": "Total", "amount": 2999 } ], "links": [ { "type": "terms_of_use", "url": "https://www.checkout.com/legal/terms-and-conditions" }, { "type": "privacy_policy", "url": "https://www.checkout.com/legal/privacy-policy" } ], "payment_mode": "test" } } } ``` ChatGPT uses the `merchant_id` value to call the Checkout.com delegated token endpoint and render the appropriate payment UI. ### Retrieve a checkout session With the payment token, ChatGPT calls your `get_checkout_session` tool using the session ID: ```json { "session_id": "cs_1776170582038" } ``` Return the current session state from your backend, including item details, status, and totals. ### Update a checkout session To modify an active checkout, ChatGPT calls your update tool with a `POST /checkout_sessions/{id}` request. For example, if you need to change the item quantity or the fulfillment address. Apply the changes in your backend and return the updated session. ### Complete a checkout session When the customer confirms the purchase, ChatGPT collects their card details, calls the Checkout.com delegated token endpoint, and sends the resulting token to your `complete_checkout_session` tool: ```json { "checkout_session_id": "cs_1776170582038", "buyer": { "name": "Jia Tsang", "email": "jia.tsang@example.com" }, "payment_data": { "token": "tok_5pg3c3zuexlu3dehjhmkkbwpta", "provider": "checkout", "managed_by": "agentic_platform_psp", "billing_address": { "name": "Jia Tsang", "line_one": "654 Main St.", "city": "Anytown", "state": "WY", "country": "US", "postal_code": "332211" } } } ``` Use the `payment_data.token` value to call the Checkout.com Payments API with `source.type` set to `"token"`: > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payments` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments` ### Request example ```json { "source": { "type": "token", "token": "tok_5pg3c3zuexlu3dehjhmkkbwpta", "billing_address": { "address_line1": "654 Main St.", "city": "Anytown", "state": "WY", "zip": "332211", "country": "US" } }, "amount": 2999, "currency": "USD", "payment_type": "Regular", "merchant_initiated": false, "authorization_type": "Final", "capture": true, "reference": "cs_1776170582038", "customer": { "email": "jia.tsang@example.com", "name": "Jia Tsang" }, "processing_channel_id": "pc_abcd1234efgh5678", "risk": { "enabled": true } } ``` Return the Checkout.com payment result to ChatGPT through your tool response to confirm the order to the customer. ### Cancel a checkout session When the customer cancels a purchase, ChatGPT calls your `cancel_checkout_session` tool with the session ID and a cancellation reason: ```json { "session_id": "cs_1776170582038", "reason": "Customer requested cancellation" } ``` Cancel the session in your backend and return an HTTP 200 response to confirm the cancellation to ChatGPT. --- ## Test the integration Use the following example prompts to test each ACP request in ChatGPT developer mode. Replace the product name with an item from your catalog. | Use case | Prompt | Expected behavior | | --- | --- | --- | | List products | "List all products in the store." | ChatGPT calls your product tool and displays the catalog | | Create a checkout session | "Create a checkout session for 1 `{product name}`." | ChatGPT calls your `create_checkout_session` tool and returns a session ID | | Retrieve a checkout session | "Get the details of the checkout session you just created." | ChatGPT calls your `get_checkout_session` tool with the session ID | | Complete a checkout | "Complete the checkout session you just created." | ChatGPT collects card details, generates a token, and calls your `complete_checkout_session` tool | | Cancel a checkout | "Please cancel my order." | ChatGPT calls your `cancel_checkout_session` tool with a cancellation reason | Use [test cards](https://www.checkout.com/docs/developer-resources/testing/test-cards.md) to simulate different payment outcomes.