Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I am new to Shopify and am working through this guide: https://help.shopify.com/en/api/guides/sell-through-the-checkout-api
So far I have done this in Shopify:
1. Created the test store
2. Created the Private App in test store
3. Under Private App ADMIN API PERMISSIONS I have set everything to “Write” permission where applicable
4. I have checked on “Allow this app to access your storefront data using the Storefront API”. This generated the store access key which I am passing in the request header as "X-Shopify-Storefront-Access-Token".
When I try to pass a request to "/admin/customers.json" service to create a checkout I am getting this response:
Response.StatusCode = Forbidden
Content = “[API] This action requires merchant approval for write_checkouts scope.”
My question: How do I grant the required “write_checkouts scope” so this API call will work?
Hey Bill,
I believe you meant "pass a request to '/admin/checkouts.json' service". Anyhow, your app should be sales channel and use Shopify's Sales Channel SDK - https://help.shopify.com/en/api/guides/sales-channel-sdk
Hope that helps!
Sorry for the type error. I did intend to refer to admin/checkouts.json' service
As I mentioned:
4. I have checked on “Allow this app to access your storefront data using the Storefront API”. This generated the store access key which I am passing in the request header as "X-Shopify-Storefront-Access-Token".
Doesn't this make my app a sales channel ? So i believe this is alread done
In the article you referred me to it instructs you to use this to grant the permission I asked about:
https://{shop}.myshopify.com/admin/oauth/authorize?client_id={api_key}&scope={scopes}&redirect_uri={...
So, I tried entering this into a browser:
(of course making the appropriate replacements for {shop} and {apikey}).
It returns a page stating: Oauth error invalid_request: The Shopify API application does not support oauth
So, i cannot find any way to grant the write_checkouts permission. That is my problem
Can someone provide the exact steps I would need to follow to grant the write_checkouts permission?
Hey Bill,
Nope, creating the token doesn't make your app a channel. You have to turn your app into a sales channel by going to App Setup > Sales Channels section > click on "Turn app into sales channel".
Hope that helps!
Ok... There is probably something very basic here that I am not getting.
Where do you access the "App Setup" menu you refer to? I do not see where to access this menu.
In my test store I see the "SALES CHANNELS" section in the left hand pane. When I click the "+" it displays a "Add sales channel" modal popup with a list of sales channels I can add. There is also a "manage sales channels" link in the popup which displays a list of sales channels I have added.
Nowhere do I see the: Sales Channels section > click on "Turn app into sales channel"
It sounds easy. I just cant find where to do this. Anyway I can see a picture of this or something to help me see where to access this menu?
Thanks for helping!
Hey Bill,
Login to your partners account https://partners.shopify.com/ (that's the portal you have used to create your private app), in the left handside menu choose Apps, click on your private app and in the upper toolbar you should see App Setup button.
Cheers!
Gotcha. Thanks!
I got a little farther. Thanks again! but I am still haivng a problem:
I created the app in the parthers site as you instructed. Connverted it to a sales channel app.
I then executed the URL to grant permissions in the test store:
https://{mystore}.myshopify.com/admin/oauth/authorize?client_id={partner API Key}&scope=write_checkouts,read_checkouts,read_orders,write_orders,read_customers,write_customers&redirect_uri=http://myapp.com/&state=1234
I saw the form to acknowledge the installation and my partner app is now listed under the test store's sale channels. So I think I have completed this prerequisite.
Now I am trying to make the service request to create a checkout object. I am using the API key/password created in partner app for the request authentication. But, what should I pass for "X-Shopify-Storefront-Access-Token" in the header? The parther app does not have a store access key...
When I try to use the partner api key/password with no "X-Shopify-Storefront-Access-Token" I am getting the error: Unauthorized - "[API] Invalid API key or access token (unrecognized login or wrong password)".
It seems that the partner app api key/password is not working. Or I need to somehow get a store access token. But I can only generate store access tokens in the test store's private apps.
What API key/password/store access token should I be passing with the request?
Hey Bill, sales channels are only available to non-private apps (but you don't need to publish it to the app marketplace to make use of it). So yes, in order to be able to do what you are trying to do, you'll have to setup your services to support the installation of a regular app, including the access token request. More information here https://help.shopify.com/en/api/tutorials/building-public-app
Hey SSvinarciuc,
I'm using postman to create checkout and stuck on same point like Bill6. Will you please help me on this?
Thank you,
Ashaar
Hey shopify team,
I am also stuck on using the checkouts.json api
Thanks,