Subscription Contract Not Created But Selling Plan Id Applied

All of the orders in our shop which have been purchased as subscriptions have a selling plan but no contract.

This was discovered when we queried our orders via GraphQL. This is an example where the order has a PlanId but no contracts:

'lineItems':
    {
        'edges': [
        {
            'node':
            {
                'sellingPlan':
                {
                    'sellingPlanId': 'gid://shopify/SellingPlan/608338083'
                },
                'contract': None
            }
        }]
    }

The order Gid for above is gid://shopify/Order/4789784182947

We have hundreds of other orders which have a sellingPlanId but no contract.

Is this a known bug? This is an important issue which is adversely impacting our operations.

Note that we are aware of this similar thread from 2022 but was asked by Shopify Staff to create a new topic: https://community.shopify.com/c/subscriptions-apis/subscription-contract-not-created-but-selling-plan-id-applied/m-p/2221284

Hi Devices1,

Would you be able to share some more recent examples (within 2 months)?
I can see that this order was created at 2022-12-27 and unfortunately we don’t have the log anymore for me to debug further.

On the other hand, a recent order 5126537576611 seems have the contract successfully created.

Thank you!

Hi Qc11,

We can use the order you’ve shared (Order 5126537576611) as an example to investigate. I tried querying this order via the GraphQL API and it does not show a contract.

I ran the following query:

{
    order(id:"gid://shopify/Order/5126537576611") {
      id
      lineItems(first:1) {
        edges {
          node {
            currentQuantity
            sellingPlan {
              name
            }
            contract {
              id
            }
          }
        }
      }
    }
}

And got the following response:

'data': {
        'order': {
            'id': 'gid://shopify/Order/5126537576611',
            'lineItems': {
                'edges': [
                {
                    'node': {
                        'currentQuantity': 1,
                        'sellingPlan': {
                            'name': ' Primary Plan '
                        },
                        'contract': None
                    }
                }
                ]
            }
        }
    }

The Contract field returns None.

The GraphQL API endpoint I’m calling is version 2023-07 but I have tried this with all the other available API versions (including 2023-10) and get the same result.

My app has all of the required OAuth permission scopes:

[‘read_orders’, ‘read_all_orders’, ‘read_own_subscription_contracts’] so it is not a permissions issue (also we would be getting a 401 error).

So it appears that the contract is successfully being created but the contract information is not being returned in the API. Could you investigate why this is happening? Are you able to obtain the contract information from this order when you run the same query above?

Hi, could you confirm if you are using Native Subscriptions app? I’m able to get it viaNative Subscriptions app.

If you are using a different app, you wouldn’t be able to read the contracts owned by another apps.

I was not aware that contracts could not be accessed cross-app, that explains it.

We need to be able to fetch the information from our Contracts via API to automate our store operations. Could you share how you are able to query the Orders via Native Subscriptions app?

Are you using the access token that is shared with the app? I can’t find where I can fetch this access token to use in our own queries within the admin UI.

Unfortunately, I was only able to do that internally.
As for now, only the app that owns the subscription contracts can read and write on their contracts.

Thanks Qc11, it would be useful to put this caveat:

only the app that owns the subscription contracts can read and write on their contracts.

in the Shopify GraphQL API reference somewhere. This was not documented anywhere and affects other APIs which all return null.

For example, the subscriptionContracts query is one which is affected by this: https://shopify.dev/docs/api/admin-graphql/2023-07/queries/subscriptionContracts

It would be worthwhile including the above information within this API reference.