Why Am I Forbidden From Creating A Checkout Using The Shopify API Ruby Gem

- 1 answer

Is any using the Shopify API rub gem? I'm building a headless storefront where few things not working. I can fetch Products but cannot create a checkout so I can add items to cart.

Ruby: 2.7.0 Rails:

The setup:


shop_url = "https://#{ENV['SHOPIFY_API_KEY']}:#{ENV['SHOPIFY_PASSWORD']}@#{ENV['SHOP_NAME']}" = shop_url
ShopifyAPI::Base.api_version = ENV['STORE_API_VERSION'] # find the latest stable api_version [here](

The above is per docs as Im using a private app.

In a controller:

product = ShopifyAPI::Product.find('12345678')
# This works fine. Now:

checkout = ShopifyAPI::Checkout.create
# <ActiveResource::ForbiddenAccess: Failed.  Response code = 403.  Response message = Forbidden.>

The create I got from their tests but it's "blowing up".

I tried to understand how to add items to cart and their JS example shows that on page load, they create a checkout then use its id when adding items to cart.

Though my frontend is JS, everything runs through Rails.




The Checkout API requires your APP to be public.

In addition your app must be set as a Sales Channel ( which privates APP's can't do, that's why you need a public one ) and your products must be available to that sales channel in order to add them to the checkout.

As an alternative you can use the Storefront API