IAP subscription management

Hey there! Following the IAP 4 to 5 upgrade, I can see huge gap — the guide says nothing about the subscription management process.

  1. In IAP 4.x to get SubscriptionInfo I could use SubscriptionManager. Where can I get it now?
  2. Previously, I used SubscriptionManager.UpdateSubscriptionInGooglePlayStore and SubscriptionManager.UpdateSubscriptionInAppleStore for cross- down- or upgrade scenarios. As this class is now obsolete and not mentioned in any transition guide, how could I handle these scenarios?
    I can assume everything is now handled under the hood, so calling _controller.PurchaseProduct(newSubscription); should do the trick, though I’m not sure.

Thanks in advance for any thoughts!

Hey @danieldaniil ,

Great callout. Both are covered in v5, just differently.

  1. SubscriptionManager is deprecated but SubscriptionInfo is still there. In v5 you get it from confirmed orders in OnPurchasesFetched via order.Info.SubscriptionInfo. Same methods as before (GetExpireDate(), IsAutoRenewing(), etc.), full list in the SubscriptionInfo class reference.
  2. This one depends on the platform. On Apple (StoreKit 2) your assumption is right. PurchaseProduct(newSubscription) handles tier changes within the same subscription group automatically. On Google Play it’s different. Calling PurchaseProduct() alone won’t replace the existing subscription, it’ll create a second active one. Instead you need to use UpgradeDowngradeSubscription(), passing it the current active order, the new product, and a proration mode. That’s what tells Google what’s being replaced.

Let me know if you have any questions about this!

Randy

Hey, Randy!
Thanks for your reply, it helped a lot. Have a wonderful day!