Use for "shopify-checkout-api-token" & easier way to checkout?

rock
Tourist
8 0 1

I have a quick question, so I see the "shopify-checkout-api-token" is available to the public via the HTML tags. I am wondering, what is the use for it? If I don't have access to /admin then how can I use it. I am looking to develop an app for a client that allows them to have a feed of products from different stores, and in the end it automatically checks out all . their carts at one time using the shopify api. I cant find any documentation on checking out or generating checkout links quickly without having to reverse the frontend.

 

Thank you so much & glowing regards,

rock

Replies 4 (4)

Alex
Shopify Staff
1561 81 341

If you're seeing it in an HTML element I'd say it's best to assume that it's not for use by Shopify apps, or clients on the storefront looking through the DOM. I'm not sure your idea is going to work without having API clients connected to these shops that you're aggregating, and then you'd have to find a way to safely get credit card information into the checkout forms to actually process the checkout, which you're not going to do without having an app with payment processing permissions (your app is required to be a sales channel for this, it might be something you want to look into, since acting as a sales channel sounds a bit like your use case).

 

The token is what lives on the end of the checkout URL, assuming you just want to craft those, so: https://domain.myshopify.com/18515255/checkouts/172e750e83fc29e35d8f617fc2200850

 

The integer in the URL is the Shop ID though, which I don't believe is exposed anywhere. Just know, that if you're using a web client to crawl the storefront, you may get detected as a bot and thus throttled.

 

Take what I'm saying with a grain of salt since again, that HTML element in general is not meant to be used for programmatic interaction with a shop. We recommend using authenticated connections via our API. As mentioned earlier, maybe look into the Sales Channel SDK.

 

Cheers.

Alex | 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

rock
Tourist
8 0 1

First, thanks for the response!

 

Second, generating the token would be a great help because listing the links for checkout is step one in the process. Is it as simple as a public API to do this? What about throttling and polling which was stated in the documentation for admin?

 

The token in the HTML wont let me load a checkout with it at the end.

 

Glowing regards,

rock

Alex
Shopify Staff
1561 81 341

No public APIs for that unfortunately. You would need to be installed on the merchant's store either as a private app or a public app (listed on the app store or otherwise) to have the ability to explicitly generate checkout links in a supported way. If you decide to take that path, you can use the Storefront API or the Admin API (by creating checkouts directly or creating draft orders to get checkout links to finish the orders).

 

Cheers.

Alex | 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

rock
Tourist
8 0 1

But you mentioned that the "shopify-checkout-api-token" was the token at the end. I am a bit confused. I am just wondering how that api key/token can be used.