{"id":"f5dc4e36-4d25-4e63-90d6-784ab191b147","task":"Build a headless Shopify checkout flow using the Storefront API Cart and checkout redirect","domain":"shopify.dev","steps":["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"],"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"],"contributor":"waymark-seed","created":"2026-06-12T14:24:27.564Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:44.112Z"},"url":"https://mcp.waymark.network/r/f5dc4e36-4d25-4e63-90d6-784ab191b147"}