Custom App Admin API getting 403 error?

LouisFerreira
Visitor
3 0 2

I am using 'ShopifySharp' library in a C# custom app. I want to be able to send a user from my website to the Shopify Checkout, and I understand that I need to create a checkout request passing in the productId and quantity. I've reviewed the url and params from the ShopifySharp library, and all seems in line with the documentation.  However, when I make the request, I get a 403 error as shown below.

 

One or more errors occurred. ((403 Forbidden) [API] This action requires merchant approval for write_checkouts scope.)

 

I have gone through the settings of the app in Shopify and granted the checkout permission:

unauthenticated_write_checkouts, unauthenticated_read_checkouts

but still getting this error.

Any suggestions? 

Replies 3 (3)

ShopifyDevSup
Shopify Staff
1363 228 477

Hi @LouisFerreira 👋

 

For support with ShopifySharp, it may be best to reach out in the repo directly as it is a third-party library. If the underlying API request uses the Admin REST API `/checkout.json` endpoint, the app will need to be granted the `write_checkouts` scope. The `/admin/oauth/access_scopes.json` endpoint can be used to check the scopes currently available to the app. 

 

Hope that helps!

 

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

LouisFerreira
Visitor
3 0 2

Thankyou for your reply.

The problem is not with ShopifySharp as I am getting the same error with other REST clients like Postman.

You mentioned that I need to grant the write_checkouts scope... but I cannot see this scope in the list of available scopes (either Admin or Storefront API's configs), I only see the unauthenticated_write_checkouts scope in the Storefront API configuration.

Where do I find this scope?

 

Screenshot 2023-04-19 080454.png

 

Screenshot 2023-04-19 080731.png

ShopifyDevSup
Shopify Staff
1363 228 477

Hi @LouisFerreira,

 

The permissions 'unauthenticated_write_checkouts' and 'unauthenticated_read_checkouts' are for the GraphQL Storefront API and instructions on how to use it to build a cart and get a checkout URL are [here] - this might not be supported by the 'ShopifySharp' library.

 

The 'write_checkouts' scope is not available to store based Custom apps like the one in the screenshots and can only be requested by 'Sales Channel' type apps which have their own specific requirements, more info here:
https://shopify.dev/docs/apps/channels#sales-channel-app-requirements

 

Hope you have a great day

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog