--- title: Checkout for agents description: >- Complete purchases in agentic commerce applications using checkout URLs from the Catalog MCP server. source_url: html: 'https://shopify.dev/docs/agents/checkout' md: 'https://shopify.dev/docs/agents/checkout.md' --- ExpandOn this page * [Get the checkout URL](https://shopify.dev/docs/agents/checkout.md#get-the-checkout-url) * [Redirect to checkout](https://shopify.dev/docs/agents/checkout.md#redirect-to-checkout) * [Embed with Checkout Kit](https://shopify.dev/docs/agents/checkout.md#embed-with-checkout-kit) * [Handle multiple merchants](https://shopify.dev/docs/agents/checkout.md#handle-multiple-merchants) # Checkout for agents Early access Agentic commerce is rolling out to Dev Dashboard. [Sign up to be notified](https://docs.google.com/forms/d/e/1FAIpQLSe4DsRrfytH6CBrolSJdPKLyl-e-K2MEBDOjm-F-ZJpNy6Vtw/viewform). Checkout is the final step of the buyer journey in agentic commerce. After your agent helps a buyer discover products through the [Catalog](https://shopify.dev/docs/agents/catalog), you need to send them to Shopify Checkout to complete their purchase. Shopify provides two paths for presenting checkout: * **Redirect to checkout**: Open checkout in a new tab by redirecting buyers to the `checkoutUrl` returned by the Catalog MCP server. * **Embed with Checkout Kit**: Embed checkout directly in your application using the `` web component or native SDKs for mobile apps. Both paths start with the checkout URL from the [Catalog MCP server](https://shopify.dev/docs/agents/catalog/mcp). *** ## Get the checkout URL The Catalog MCP server returns a `checkoutUrl` with every product response. This URL is a cart permalink that takes buyers directly to the merchant's checkout with their selected items preloaded. When you call `get_global_product_details`, the response includes a `checkoutUrl` for the selected product variant: ```json { "product": { "products": [{ "checkoutUrl": "https://example.myshopify.com/cart/70881412:1?_gsid=abc123&payment=shop_pay", "selectedProductVariant": { "id": "gid://shopify/ProductVariant/70881412" } }] } } ``` The URL includes the variant ID, quantity, and tracking parameters for conversion attribution. *** ## Redirect to checkout The simplest integration is redirecting buyers to the `checkoutUrl`. How you handle this depends on your application—you might open a new tab, display a popup, use an iframe, or handle the redirect in another way. For example: ```javascript const checkoutUrl = productResponse.product.products[0].checkoutUrl; window.open(checkoutUrl, "_blank"); ``` *** ## Embed with Checkout Kit For a more integrated experience, use Checkout Kit to embed checkout directly in your application. Pass the `checkoutUrl` to the SDK, and buyers complete their purchase without leaving your app. [Embed checkout using the web component. - Web](https://shopify.dev/docs/storefronts/mobile/checkout-kit/web) [Embed checkout in iOS apps using the Swift SDK. - Swift](https://shopify.dev/docs/storefronts/mobile/checkout-kit/swift) [Embed checkout in Android using the Kotlin SDK. - Android](https://shopify.dev/docs/storefronts/mobile/checkout-kit/android) [Embed checkout in React Native apps. - React Native](https://shopify.dev/docs/storefronts/mobile/checkout-kit/react-native) *** ## Handle multiple merchants Cart permalinks work for products from a single merchant. If your agent surfaces products from different merchants, you can create separate checkouts for each. For example: ```javascript const productsByShop = {}; selectedProducts.forEach(product => { const shopDomain = new URL(product.shop.onlineStoreUrl).hostname; if (!productsByShop[shopDomain]) { productsByShop[shopDomain] = []; } productsByShop[shopDomain].push(product); }); Object.entries(productsByShop).forEach(([shopDomain, products]) => { const variantIds = products.map(p => { const id = p.selectedProductVariant.id.split('/').pop(); return `${id}:1`; }).join(','); const checkoutUrl = `https://${shopDomain}/cart/${variantIds}`; console.log(`Checkout for ${shopDomain}: ${checkoutUrl}`); }); ``` *** * [Get the checkout URL](https://shopify.dev/docs/agents/checkout.md#get-the-checkout-url) * [Redirect to checkout](https://shopify.dev/docs/agents/checkout.md#redirect-to-checkout) * [Embed with Checkout Kit](https://shopify.dev/docs/agents/checkout.md#embed-with-checkout-kit) * [Handle multiple merchants](https://shopify.dev/docs/agents/checkout.md#handle-multiple-merchants)