Build a sales channel with the Checkout API
This guide teaches you how to enable payments so that customers can place orders for merchants’ products. The guide also covers how you can bill for your app to make money from your sales channel. For purposes of example, we'll build a sales channel that enables customers to purchase a single merchant's products from your platform. When you build a sales channel you can use either the Admin API or Storefront API depending on your business case and the needs of your app.
This guide assumes that you're familiar with the following:
By building a sales channel for Shopify, you can connect merchants' products with customers on web, mobile and in-game. For example, you could use the Admin API to build an app that allows merchants to integrate products, orders, and customers with your channel. You could also use the Storefront and Admin APIs to develop a mobile app builder by leveraging the Mobile Buy SDKs.
Payments and order management
Building a sales channel with the Checkout API represents lower integration effort because Shopify makes it easy to handle the complexities of payment processing:
- Shopify offers a variety of payment processing options, depending on your business case and the needs of your app.
- When you use the Checkout API, Shopify handles paying out to the merchant for you.
- If you use the Billing API, then it's easier to charge merchants platform fees.
- Shopify keeps track of orders and fulfilments.
- Shopify handles disputes, refunds or cancellations.
Creating and completing checkouts
Regardless of what API you choose, checkout creation and completion follows a similar flow and involves similar Shopify resources:
- Obtain the line item data necessary to create the checkout object
- Specify the shipping information (address, rate) and customer information
- Complete the checkout using the payment completion option that is right for your app:
- Shopify web checkout
- third party tokenization service (Stripe, Spreedly)
- Shopify card vault
Shopify processes the checkouts and handles payouts to the merchants for you.
REST Admin API request throttle
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
- Response header
X-Checkout-Queue-Tokenset to the queue token value
_checkout_queue_tokencookie 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.
You can use Shopify's Billing API to charge merchants for your sales channel app. When using the Billing API, you can either charge merchants a recurring monthly subscription, or take a commission on sales by creating usage charges. Whichever charging model you use, you need to first create an appSubscription resource. Then, for commission-based sales, you need to create usage charges.
You can use the appSubscriptionCreate mutation to create a recurring charge. The mutation returns the app subscription ID.
Charging commissions requires two steps:
- Create a usage pricing plan with the appSubscriptionCreate mutation.
- Create a usage record.
If you're charging commissions, then you need to be aware of how your app's fees impact merchant payouts, and how Shopify's platform fee works. The following diagram shows the lifecycle of this process. For demonstrative purposes, the app needs to charge 10 % fees on $100 in sales.