cart-token and checkout-token

Nate_P
Shopify Partner
3 0 2

I'm writing a function that will put an order to Shopify through the API.  I don't know how the cart-token and checkout-token are generated on the Shopify side when an order is created.  Does anyone know how I can set those to be generated by Shopify when the order is put?

Replies 5 (5)

Ben_Cox
Shopify Staff (Retired)
94 0 18

Can you provide a few more details on what you're trying to do?

Creating orders through our Order API won't require you to worry about either of these tokens as these are generated on Shopify's side for each action (cart creation and checkout creation, neither of which happen when creating only an order). 

Ben | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

kamranblueeast
Tourist
5 0 0

As you mentioned cart_token is generated on Shopify side. I just want to know that if this token remains same all the time when one add to cart from a specific store or changes after some time. Is there any expiry for this cart_token?

Nate_P
Shopify Partner
3 0 2

I'm trying to use the API for the company I work for, which can create an order, then push that order to the Shopify API.  

Ben_Cox
Shopify Staff (Retired)
94 0 18

Great, so you don't need to worry about those tokens 🙂 You can create the Orders directly through the Order API 

Ben | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

tolgapaksoy
Shopify Partner
105 7 64

If you use Order API, you will have to:

 

  1. Calculate taxes based on billing address (quite hard)
  2. Calculate appropriate shipping rates (quite hard)

So you can't just simply create Orders without doing a BUNCH more work on other (unrelated) things. The checkout API neatly calculates taxes and appropriate shipping rates for you.

If these were supported in the Order API, it would be lovely though. This is by far my biggest pain point in the Order API.