How to create checkout by api in online store

How to create checkout by api in online store

Shopify Partner
7 0 2

In my Online Store, when my customer clicks the "buy now" button,  a checkout should be created with some product variant line items. I have tried some APIs, but all of them do not work very well. 

Background / Context

Before starting, some information should be kept in mind: 

1. I am only talking about Online Store, the default channel.

2. the store installed an custom app which is created in Shopify Admin. the custom app is not created by Shopify Partner

What I tried or I am going to try

Solution 1 :  Cart permalink

The trouble is :  line item properites is not supported. 


Solution 2:  Storefront API CheckoutCreate

There are some troubles: 

  1. Abandoned Checkout / Order triggered by the checkout would be marked as "From xxx app" instead of  "From Online Store"
  2. Abandoned Checkout would not send emails because of "From xxx app"
  3. Analytics treats my custom app and  Online Store as two channels.
  4. It requires that sales channels of the products should including my custom app. This would create an additional mental burden for operators.

I just use my custom app to enhance the Online Store, if my custom app is treated as Online Store channel, those troubles would gone and Solution 2 would work well. 


Solution 3: AJAX API about cart ?

I am going to try. But I am not sure this is a good solution, because :

  • It would modify to override items the existing cart of the customer.
  • It seems that the api doc does not officially tell how to get the checkout page url based on the cart.


So, what is the right way to implement the custom checkoutCreate function to enhance Online Store ?



Reply 1 (1)

1 0 0

I have the same issue, but I also need to keep track of which products came from my costume app. 

I will try using the Shopify API to create a Shopify app to solve this, but not sure if it would produce the same outcome as solution 2. 

did the third solution work for you?