Permissions for SellingPlanGroupAddProducts

Solved
reid-garner
New Member
4 0 0

I am trying to add products to existing subscriptions, and according to the documentation you need write_products access scope, however when trying the mutation, I get 

"errors":[{"message":"SellingPlanGroupAddProducts access denied"

I have also tried adding the write_own_subscription_contracts,read_own_subscription_contracts,read_customer_payment_methods scopes as discussed in other subscription based items, however for these I get an oauth error on missing permissions.

My app is a custom app.

 

Anyone have any input on the scopes needed to do this?

Thanks,

Reid

 
Accepted Solution (1)

Accepted Solutions
csam
Shopify Staff
154 24 25

This is an accepted solution.

Hi @reid-garner 

So I've been able to find that your app doesn't have permissions enabled for subscriptions. This is something you can request to be enabled from within the partner dashboard in the app under "App setup" - it looks like: 
21-11-wp4c5-57z98

 

Once the permissions are enabled there, your requests should go through as expected and allow you to add products to the selling plans.

Best,

CS | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 6 (6)
reid-garner
New Member
4 0 0

Also incase it helps, here is the mutation/response

 

Mutation that I am using:
mutation{
                sellingPlanGroupAddProducts(id:"gid://shopify/SellingPlanGroup/110133397" productIds:"gid://shopify/Product/7212622807189" )
                {
                    userErrors{
                        field
                        message
                    }    
                }
            }
 
 
 
and the response:
 
 [headers] => Array
        (
            [status] => HTTP/1.1 200 OK
            [Date] => Mon, 08 Nov 2021 19:10:33 GMT
            [Content-Type] => application/json; charset=utf-8
            [Transfer-Encoding] => chunked
            [Connection] => keep-alive
            [X-Sorting-Hat-PodId] => 148
            [X-Sorting-Hat-ShopId] => 57253986453
            [Vary] => Accept-Encoding
            [Referrer-Policy] => origin-when-cross-origin
            [X-Frame-Options] => DENY
            [X-ShopId] => 57253986453
            [X-ShardId] => 148
            [X-Stats-UserId] => 
            [X-Stats-ApiClientId] => 6029787
            [X-Stats-ApiPermissionId] => 339770933397
            [X-Shopify-API-Version] => 2021-10
            [Content-Language] => en
            [Strict-Transport-Security] => max-age=7889238
            [X-Shopify-Stage] => production
            [Content-Security-Policy] => default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.shopifycs.com https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=688fe46f-f8dd-406d-a838-c2a1bc3fce0c
            [X-Content-Type-Options] => nosniff
            [X-Download-Options] => noopen
            [X-Permitted-Cross-Domain-Policies] => none
            [X-XSS-Protection] => 1; mode=block; report=/xss-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=688fe46f-f8dd-406d-a838-c2a1bc3fce0c
            [X-Dc] => gcp-us-east1,gcp-us-east1,gcp-us-east1
            [X-Request-ID] => 688fe46f-f8dd-406d-a838-c2a1bc3fce0c
            [CF-Cache-Status] => DYNAMIC
            [Expect-CT] => max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
            [Server] => cloudflare
            [CF-RAY] => 6ab11a245960420f-YYC
            [alt-svc] => h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
        )

    [body] => {"data":{"sellingPlanGroupCreate":null},"errors":[{"message":"SellingPlanGroupCreate access denied","locations":[{"line":3,"column":4}],"path":["sellingPlanGroupCreate"]}],"extensions":{"cost":{"requestedQueryCost":10,"actualQueryCost":10,"throttleStatus":{"maximumAvailable":2000.0,"currentlyAvailable":1990,"restoreRate":100.0}}}}
 
csam
Shopify Staff
154 24 25

Hi @reid-garner 

Thanks for the follow up! I am seeing similar results from my testing here. I'm going to investigate this a little more and I'll let you know what I find.

Best,

 

CS | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

reid-garner
New Member
4 0 0

Thanks!

Glad it wasn't just me being an idiot

csam
Shopify Staff
154 24 25

This is an accepted solution.

Hi @reid-garner 

So I've been able to find that your app doesn't have permissions enabled for subscriptions. This is something you can request to be enabled from within the partner dashboard in the app under "App setup" - it looks like: 
21-11-wp4c5-57z98

 

Once the permissions are enabled there, your requests should go through as expected and allow you to add products to the selling plans.

Best,

CS | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

reid-garner
New Member
4 0 0

Thanks.  It maybe should be added to the docs   

Also I could have sworn that I looked through there, and didnt see that, I must be blind

csam
Shopify Staff
154 24 25

Yes, I will for sure pass this along to our docs team, as it only currently mentions the write_products scope in the required permissions section. 

I missed it at first too! Not enough coffee I guess  

CS | API Support @ 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 Shopify.dev or the Shopify Web Design and Development Blog