How the checkout flow works
Step 1: Cart creation
The agent sends aPOST to /ucp/checkout with the cart items and shipping address:
Cart request fields
Array of cart line items. Each item must include
product_id, variant_id (if applicable), and quantity.The
id of the product from your catalog endpoint.The
id of the specific variant. Required for products with variants — omit only for products with no options.Number of units. Must be a positive integer.
Customer’s shipping address. Used to calculate applicable shipping options and tax.
Recipient’s full name.
Street address including house number.
City name.
State, province, or region code (e.g.
"CA", "NY").Postal or ZIP code.
ISO 3166-1 alpha-2 country code (e.g.
"US", "GB", "IN").Step 2: Order confirmation
The agent sends the customer’s chosen shipping option and a payment token obtained from your PSP’s client-side SDK:Payment provider integration
UCP is payment-provider-agnostic. Integrate the PSP you already use.- Stripe
- Razorpay
- PayPal
Create a PaymentIntent when the agent confirms the order:
Error responses
Return structured error objects so agents can relay accurate information to the customer and, where possible, recover automatically.Payment failure
Out of stock at confirmation
Invalid shipping address
Security requirements
- Serve all checkout endpoints over HTTPS
- Validate all incoming request fields — item IDs, quantities, addresses — before processing
- Implement idempotency keys to prevent duplicate orders if the agent retries a request
- Re-check inventory availability at confirmation time, not just at cart creation
- Never handle raw card data directly; accept only PSP-issued payment tokens
Best practices
Re-validate inventory at confirmation
Re-validate inventory at confirmation
Inventory can change in the minutes between cart creation and order confirmation. Always check stock again before processing the payment — not just when the cart session is opened.
Set and return session expiry
Set and return session expiry
Cart sessions should expire after 15–30 minutes. Include
expires_at in your cart response so agents know when the session becomes invalid. If an agent tries to confirm an expired session, return a clear error with code: "session_expired".Return actionable error messages
Return actionable error messages
Error messages are read directly by the AI agent and presented to the customer. Descriptive messages reduce confusion and help agents offer next steps (e.g. suggesting an alternative size or payment method).
Send fulfillment webhooks
Send fulfillment webhooks
Once an order is placed, push fulfillment and tracking updates via webhook so the customer receives proactive shipping status inside the AI conversation — without needing to check their email.
Next steps
ACP checkout guide
Implement ChatGPT Instant Checkout via the Agent Commerce Protocol.
Razorpay agentic payments
UPI-native agentic payments for Indian merchants.