Subscription contacts

I’m using the Shopify subscription APP to manage the subscriptions. The custom APP uses subscription based module, so we need the customer subscription information when they logIn. If customer subscription is active then we’ll allow customer, if not then we show the message you subscription expired.

I have tried to Admin Graphql but not able fetch the customer contracts. Is there any other way we can get the subscription contracts. Please let me know.
Thanks!

Perhaps provide some more information on this, any errors etc and we may be able to help.

Using this graphql:

query {
customer(id: “gid://shopify/Customer/id”) {
displayName
defaultEmailAddress{
emailAddress
}
subscriptionContracts(first: 10) {
nodes {
status
}
}
}
}

I’m able to get the customer info, but their subscriptionContracts node is empty.
There is no error.

I checked the customer have order the subscription product I can see in the Order & in the Shopify subscription APP.

Hi @Chandni_Handa! This is expected behavior - subscription contracts are owned by the app that created them, not by the store. When you query subscriptionContracts with the read_own_subscription_contracts scope, you’ll only see contracts that your app created.

Since you’re using the Shopify Subscriptions app to manage the subscriptions, those contracts belong to that app. Your custom app can’t access them even with the subscription scopes enabled. This was addressed in a similar thread where the same behavior came up, and you can read more on how subscription contracts work here in our docs.

If you can share more about how your app is intended to work, I might be able to suggest some workarounds!

Okay, got it.
Is there any other way to get the customer subscriptions.

How about GraphQL Customer Account API.
Reference: Customer Account API reference

But I need the authorization code first. The reference show to hit the authorizationRequestUrl & it send the code in the redirect_uri.

Can we get the authorization code without any redirection or simply make a request, pass all input info & it return the auth code?

Please let me know.
Thanks!

Hey @Chandni_Handa - unfortunately no, there’s no way to get an authorization code without a redirect. The Customer Account API uses OAuth 2.0 with PKCE, which by design requires the user to be redirected to Shopify’s login page and then back to your app with the code. This is a security requirement - the redirect ensures the actual customer is present and consenting. You can read more about the authentication flow here.

That said, even if you implemented the full OAuth flow, I’m not sure the Customer Account API would solve your underlying problem. The subscription contract ownership model still applies - contracts belong to the app that created them. The Customer Account API lets customers view their subscription data from their perspective, but the cross-app access limitation is fundamental to how subscriptions work.

If your goal is to check subscription status when customers log in, here are some alternatives that might work better:

  1. Store a flag on the customer using metafields that any app can read. You’d need to manually update this when subscription status changes (perhaps through the Shopify admin or a Flow automation).

  2. Query the customer’s orders and check for orders with selling plan associations - though this gives you purchase history rather than real-time subscription status.

  3. If you need full control over subscription data, consider building subscription management within your own app rather than using the Shopify Subscriptions app. That way your app owns the contracts and can query them directly.

The metafield approach is probably the most practical workaround if you want to keep using Shopify Subscriptions but need subscription status accessible to your custom app.

@Donal-Shopify

Our use case is to grant loyalty benefits to customers on subscription events such as renewals, cancellations, and similar actions. For third-party subscription apps, we receive these events via webhooks directly from the app. However, we are unable to achieve the same flow with the Shopify Subscriptions app. Does this mean there is no way to listen to subscription events when a merchant is using Shopify Subscriptions? This appears to be a gap.

Hi @Mrudul_T! This is by design - subscription contracts follow an ownership model where only the app that created the contract can query it or receive webhooks for it.

I tested this on a dev store and confirmed that webhooks fired for contracts my app created, but contracts from Shopify Subscriptions aren’t even visible when querying subscriptionContracts. Same limitation applies to webhook delivery.

This was confirmed as expected behavior in a similar thread. The only partial workaround is orders/create with selling_plan_allocation in line items, but that only captures initial purchases and not renewals or cancellations.

Hi, @Donal-Shopify

So I’m thinking to use the Recharge here to manage the Subscription contract as they provide the API’s to get the customer subscription information.

But I encounter a problem. I generate the Shopify checkout URL using the custom Shopify APP.
To generate the checkout URL we used the Shopify graphql mutation createCart & passed the Recharge sellingPlanId ID & Shopify variant ID. This will generate the Checkout URL that redirects the user directly to the Shopify checkout with the Subscription item added in the checkout.

The problem is when place a order using that link order goes to Shopify fine, but not go the Recharge APP. I don’t know why this as the checkout is still in Shopify.

I have contact the Recharge support, but they not try to understand the problem & said you’r using the custom APP/functionality, so it is out of their scope.

Please let me know if you have any idea what could be the problem is.
Thanks!

Hey @Chandni_Handa - the ownership model for subscription contracts is based on who owns the selling plan, not who creates the cart. So even though your custom app is calling cartCreate, if you’re using Recharge’s sellingPlanId, Recharge should still own the resulting contract and receive the webhooks for it.

When you look at a completed order in the Admin, does the line item show the selling plan allocation? You should see something indicating it’s a subscription item with the Recharge plan attached.

If yes - the Shopify side is working correctly and this becomes a Recharge support question. I’d go back to them with evidence that the order has their selling plan attached and ask why it’s not syncing to their system.

If no - the selling plan isn’t being attached to the cart properly. Can you share the exact cartCreate mutation input you’re using? When the cart is created, does the response include a sellingPlanAllocation on the line item?

Hi, @Donal-Shopify

Thanks for the response — you understood my thinking perfectly. Yes, the Shopify order clearly shows the Recharge subscription. Unfortunately, Recharge support didn’t take the time to properly understand the issue and ended up wasting a lot of time.

I really appreciate your help.
Thanks!