Create a sales channel checkout with the Checkout API
In this tutorial, you'll learn how to create a checkout in Shopify with the REST Admin API's Checkout
resource. When you create a checkout with the Checkout API, Shopify processes the checkouts and handles payouts to the merchants for you.
Your sales channel app can provide checkout links to Shopify's web checkout for each product. Your sales channel will use Shopify's web checkout instead of building your own native checkout form.
Requirements
Anchor link to section titled "Requirements"- You've finished the channels Getting started tutorial.
Step 1: Create a checkout
Anchor link to section titled "Step 1: Create a checkout"To create a checkout and return the web URL for a single product, send the following POST request to the admin/checkouts.json
endpoint:
In response, the request returns the Checkout
object including the web_url
parameter:
You can redirect a customer to this URL for Shopify's web checkout for this product.
Step 2: Throttle REST Admin API requests (Optional)
Anchor link to section titled "Step 2: Throttle REST Admin API requests (Optional)"Requests to the REST Admin API's Checkout
resource that exceed the throttle limit return a 429 too many requests
status code and an empty JSON body with the following:
- Response header
X-Checkout-Queue
set totrue
- Response header
X-Checkout-Queue-Token
set to the queue token value _checkout_queue_token
cookie set to the queue token value
When a client receives this response, it needs to send requests to the polling endpoint to move ahead in the queue.
To learn how to send requests to the polling endpoint, refer to Poll the checkout queue.