Unable to access the SubscriptionContract

engozy
Visitor
3 0 0

Requires either all_subscription_contracts or own_subscription_contracts scope.

How I can enabled this scope? I am not seeing option to enable this. On accessing SubscriptionContracts GraphQL, I am getting following error -

 

'message': 'Access denied for subscriptionContracts field.', 'locations': [{'line': 10, 'column': 17}], 'path': ['customers', 'edges', 0, 'node', 'subscriptionContracts'], 'extensions': {'code': 'ACCESS_DENIED', 'documentation': 'https://shopify.dev/docs/admin-api/access-scopes'}}],

 

 

I am also not seeing all_subscription_contracts or own_subscription_contracts scope here  - https://shopify.dev/docs/admin-api/access-scopes

Replies 4 (4)

BStubbs
Shopify Partner
136 16 62

Hi @engozy 

Welcome to the forums! 

Some of the subscriptions API hasn't been well documented, you can see the AccessScopes as part of the tutorial on Subscriptions API:

https://shopify.dev/tutorials/create-manage-selling-plans#requirements

Hope that helps!

 

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
engozy
Visitor
3 0 0

Hi,

I have looked the requirements and looks ok to me. I have also requested permission as per the document - https://shopify.dev/tutorials/authenticate-a-public-app-with-oauth#subscriptions-apis-permissions. I am doing testing this in test app and I have tried to enable the all scope too but I am not seeing all_subscription_contracts or own_subscription_contracts scope scope in private app-

{
"access_scopes": [
  {
"handle": "write_assigned_fulfillment_orders"
},
  {
"handle": "write_customers"
},
  {
"handle": "write_orders"
},
  {
"handle": "write_product_listings"
},
  {
"handle": "write_products"
},
  {
"handle": "write_third_party_fulfillment_orders"
},
  {
"handle": "read_analytics"
},
  {
"handle": "write_discounts"
},
  {
"handle": "write_draft_orders"
},
  {
"handle": "write_fulfillments"
},
  {
"handle": "read_gdpr_data_request"
},
  {
"handle": "write_gift_cards"
},
  {
"handle": "write_inventory"
},
  {
"handle": "write_kit_skills"
},
  {
"handle": "write_legal_policies"
},
  {
"handle": "read_locations"
},
  {
"handle": "write_marketing_events"
},
  {
"handle": "write_merchant_managed_fulfillment_orders"
},
  {
"handle": "write_online_store_pages"
},
  {
"handle": "write_order_edits"
},
  {
"handle": "write_price_rules"
},
  {
"handle": "write_reports"
},
  {
"handle": "write_resource_feedbacks"
},
  {
"handle": "write_script_tags"
},
  {
"handle": "write_shipping"
},
  {
"handle": "write_locales"
},
  {
"handle": "read_shopify_payments_accounts"
},
  {
"handle": "read_shopify_payments_bank_accounts"
},
  {
"handle": "read_shopify_payments_disputes"
},
  {
"handle": "read_shopify_payments_payouts"
},
  {
"handle": "write_content"
},
  {
"handle": "write_themes"
},
  {
"handle": "write_translations"
},
  {
"handle": "unauthenticated_read_product_listings"
},
  {
"handle": "unauthenticated_write_customers"
},
  {
"handle": "unauthenticated_read_customer_tags"
},
  {
"handle": "unauthenticated_write_checkouts"
},
  {
"handle": "unauthenticated_read_content"
},
  {
"handle": "read_all_orders"
},
  {
"handle": "read_assigned_fulfillment_orders"
},
  {
"handle": "read_customers"
},
  {
"handle": "read_orders"
},
  {
"handle": "read_product_listings"
},
  {
"handle": "read_products"
},
  {
"handle": "read_third_party_fulfillment_orders"
},
  {
"handle": "read_discounts"
},
  {
"handle": "read_draft_orders"
},
  {
"handle": "read_fulfillments"
},
  {
"handle": "read_gift_cards"
},
  {
"handle": "read_inventory"
},
  {
"handle": "read_legal_policies"
},
  {
"handle": "read_marketing_events"
},
  {
"handle": "read_merchant_managed_fulfillment_orders"
},
  {
"handle": "read_online_store_pages"
},
  {
"handle": "read_order_edits"
},
  {
"handle": "read_price_rules"
},
  {
"handle": "read_reports"
},
  {
"handle": "read_resource_feedbacks"
},
  {
"handle": "read_script_tags"
},
  {
"handle": "read_shipping"
},
  {
"handle": "read_locales"
},
  {
"handle": "read_content"
},
  {
"handle": "read_themes"
},
  {
"handle": "read_translations"
},
  {
"handle": "unauthenticated_read_customers"
},
  {
"handle": "unauthenticated_read_checkouts"
}
],
}




BStubbs
Shopify Partner
136 16 62

I think you'll find there will be an error if you request all_subscriptions as well as own_subscriptions. Try with own_subscription_contracts only.

Was this helpful? Press like!
Did it fix the problem? Mark it as the solution for others!
Buy me a beer? Well, sure!
EugeneKim
Shopify Partner
60 3 27

@BStubbs (or anyone else) do you know why the all_subscription_contracts scope is causing issues? The documentation page on the SubscriptionContract object makes no indication of restrictions on the `all_subscription_contracts` scope but strangely missing from the Admin API access scopes page

 

Screen Shot 2021-06-07 at 10.10.19 AM.png