How to fetch a managed pricing plan ID from GraphQL?

Hello,

I have a script that checks the active plan of the user daily and changes it in the database.

I am currently making checks based on the plan name, but I realized this is not a reliable method because sometimes I receive a translated name. So it would be more secure to check the plan based on the plan ID instead.

But I can’t find in a GraphQL a field that represents this plan ID. This is my query

And this is my response.

1 Like

I think its in the Unstable API Version at the moment on the pricing details.

Or you can get it from the current version of webhooks

2 Likes

2025-01 webhooks don’t include plan id. Unstable webhooks have it as well.

Thanks for the info. Interesting why it doesn’t available in the current version.

Who knows? :slightly_smiling_face: At least you have a solution, for this specific call you can use unstable as the version or wait two more days to use it as 2025-04.

1 Like

I misunderstood, if it will be available in the future version. It is great :pray:

I was confused about what an unstable API version means, so I’m just leaving this here for others.

1 Like

As a developer or business owner, it’s a risk you choose to take or avoid. There are times we even use undocumented APIs. Some of them have been disabled after many years, like the transfers endpoint, for example: Transfers API Dead or Alive? - Shopify Community.

On the other hand, the variants/count.json endpoint is still working and remains undocumented: Solved: Rest api variants/count - Shopify Community. Based on my findings, it’s far more accurate than the newly released GraphQL version of it: productVariantsCount - GraphQL Admin.

I hope they include planId in the 2025-04 release because it’s an obvious must-have. However, if they don’t, it’s your decision whether to use unstable version, try to find an undocumented endpoint, implement something else, or switch back to standard pricing.

So what’s the solution at the moment to identify which managed pricing a store has using the stable graphql api version? Should we use the display name in AppInstallation.activeSubscriptions.name? Isn’t there a better way of doing it?

I cant’ think they have released something like managed pricing without having a reliable way to check the current active plan (other than webhooks)

Yeah you can use the name for display purposes. This is what I currently use

query getCurrentSubscription {
  currentAppInstallation {
    activeSubscriptions {
      id
      name
      currentPeriodEnd
      trialDays
      status
    }
  }
}

Be careful about using name, you may receive translated name. Or in my case once I received “Starter-Plan” while my name is “Starter Plan”.

They now added handles so in future I would use that probably.

2 Likes

I’m happy to be careful, but there doesn’t seem to be any alternative

1 Like

You can also use return_url. It will be the value you assigned so can be used as a unique key. Hacky way that I found for myself.

1 Like