Create a cart with the cartCreate Storefront API mutation, providing lines with merchandiseId and quantity; for subscriptions include sellingPlanId in each line
Update buyer identity on the cart with cartBuyerIdentityUpdate mutation to attach a customerAccessToken for logged-in customers, enabling pre-filled address and payment
Apply discount codes with cartDiscountCodesUpdate mutation, then query cart.cost.totalAmount to display the final price to the user
Retrieve the checkout URL from the cart.checkoutUrl field and redirect the buyer to this Shopify-hosted checkout page which handles all PCI-compliant payment processing
After the purchase, capture the order via the orders webhook (orders/create) or by polling GET /admin/api/2025-07/orders.json?source_name=YOUR_SOURCE with your storefront's source name
For post-checkout customizations, use Shopify checkout UI extensions with the thank_you and order_status targets to render custom content on the confirmation page
Known gotchas
cartCreate returns a checkoutUrl that expires — do not cache or share this URL; always generate a fresh cart and checkout URL for each session
The Storefront API requires a Storefront API access token (not an Admin API key) scoped to the storefront; passing an Admin API key returns a 401
Applying a sellingPlanId to a cart line requires the selling plan to be assigned to the specific variant; querying a product's sellingPlanGroups on the Storefront API first to get valid IDs before adding to cart
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp