Out now! Check out the Poll results: Do you have a Shopify store?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: How to grant write_checkouts permission

How to grant write_checkouts permission

Bill6
Shopify Partner
47 0 18

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? 

Replies 10 (10)

Visely-Team
Shopify Partner
1843 210 488

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!

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog

Bill6
Shopify Partner
47 0 18

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:

https://{shop}.myshopify.com/admin/oauth/authorize?client_id={apikey}&scope=write_checkouts,write_or...

(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?     

Visely-Team
Shopify Partner
1843 210 488

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!

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog

Bill6
Shopify Partner
47 0 18

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!

Visely-Team
Shopify Partner
1843 210 488

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!

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog

Bill6
Shopify Partner
47 0 18

Gotcha.  Thanks!

Bill6
Shopify Partner
47 0 18

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? 

 

Visely-Team
Shopify Partner
1843 210 488

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

Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
Ashaar
Visitor
1 0 1

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

chetansable87
Shopify Partner
1 0 0

Hey shopify team,

 

I am also stuck on using the checkouts.json api 

 

Thanks,