For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
Hi!
The problem I'm having is no matter how I query subscription contracts on a store, nothing shows. I installed a custom subscription app on a store that has existing subscriptions, (by the app "Appstle"), and nothing shows when you query subscription contracts. You can see customers have subscriptions in the Shopify admin, but there's nothing there when you use the GQL api. I've tried accessing them in bulk, by id, and through the custom object. It's always a 200 ok response but with no subscription contracts. Here's examples of my querys:
Trying all subscriptions:
{
subscriptionContracts(first:50){
edges{
node {
id
}
}
}
}
Returns:
"data": {
"subscriptionContracts": {
"edges": []
}
},
Trying by customer:
{
customers (first: 10, reverse: true){
edges {
node {
id
subscriptionContracts (first: 5){
edges {
node {
id
}
}
}
}
}
}
}
Returns:
"data": {
"customers": {
"edges": [
{
"node": {
"id": "gid://shopify/Customer/XXX",
"subscriptionContracts": {
"edges": []
}
}
}
]
}
},
Trying by id:
{
subscriptionContract(id:"gid://shopify/SubscriptionContract/10916331831") {
id
}
}
Returns:
"data": {
"subscriptionContract": null
},
I can see through the Shopify admin there are subscription contracts that exist, through the Subscription API, but no matter how I try I cannot query them. Any help is appreciated!
Thank you
Hey @mt686
I believe apps can only query for their own subscription contracts. More here: https://shopify.dev/docs/apps/selling-strategies/subscriptions/contracts#requirements
Scott | Developer Advocate @ Shopify
Thats correct - and I believe that's why they named the scope read and write own subscription contracts (`read_own_subscription_contracts`, `write_own_subscription_contracts`)
The way to query for subs would be to use your subscription app's public API