StoreKit 2 • What is subscriptionGroupID in status(for groupID: String)?

Hello,

I want to access the latest transaction for a Subscription Group. I use the following method static func status(for groupID: String) async throws -> [Product.SubscriptionInfo.Status] to access the statuses for the group, and from there, I can get a verified transaction from the status.

But when I set the GroupID equal to the Subscription Group Reference Name I put in the .storekit configuration file in Xcode, I don't have any status (so wrong ID). Actually, I have to use a subscriptionGroupID like 3F19ED53 (found using a previous transaction: https://developer.apple.com/documentation/storekit/transaction/3749718-subscriptiongroupid).

When I look into a Product, this ID is set for subscriptionFamilyId.

So my question is how can I know the ID if it's not the one I provided in App Store Connect or the config file? Do I first have to access a Product from this group?

Thanks.

Replies

In the WWDC 2021 StoreKit Demo, to get the set of statuses for a subscription group, they get the subscription statuses for a particular product and then use that, assuming all the products in the subscription group share the same set of statuses. (See the function "updateSubscriptionStatus()."

This was simple in the demo since there's only one subscription group. If you have multiple subscription groups then I guess you'd have to run a similar function on a representative product of the subscription group you're interested in.