How to get GetProductJSONDictionary() function as it is deprecated in 4.1.1

I have function like this. And as i see this function is deprecated. Can you share new
GoogleProductMetadata example?

public bool CheckSubscription()
        {
            try
            {
                IGooglePlayStoreExtensions googleplayextension = _storeExtensionProvider.GetExtension<IGooglePlayStoreExtensions>();
            Dictionary<string, string> dict = googleplayextension.GetProductJSONDictionary();
            foreach (Product item in _storeController.products.all)
            {
                // this is the usage of SubscriptionManager class
                if (item.receipt != null)
                {
                    if (item.definition.type == ProductType.Subscription)
                    {
                        string introJson = (dict == null || !dict.ContainsKey(item.definition.storeSpecificId)) ? null : dict[item.definition.storeSpecificId];
                        SubscriptionManager p = new SubscriptionManager(item, introJson);
                        SubscriptionInfo info = p.getSubscriptionInfo();
                        Debug.Log(info.getProductId());
                        Debug.Log(info.getPurchaseDate());
                        Debug.Log(info.getExpireDate());
                        Debug.Log(info.isSubscribed());
                        Debug.Log(info.isExpired());

                        if (info.isSubscribed() == Result.True && info.isExpired() == Result.False)
                            return true;
                        else
                            return false;
                        //Debug.Log(info.isCancelled());
                        //Debug.Log(info.isFreeTrial());
                        //Debug.Log(info.isAutoRenewing());
                        //Debug.Log(info.getRemainingTime());
                        //Debug.Log(info.isIntroductoryPricePeriod());
                        //Debug.Log(info.getIntroductoryPrice());
                        //Debug.Log(info.getIntroductoryPricePeriod());
                        //Debug.Log(info.getIntroductoryPricePeriodCycles());
                    }
                    else
                    {
                        Debug.Log("the product is not a subscription product");
                    }
                }
                else
                {
                    Debug.Log("the product should have a valid receipt");
                }
            }
            return false;
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
                return false;
            }
           
        }

You can pass in null for introJson, what is your intent? This may help Interface IGooglePlayStoreExtensions | In App Purchasing | 3.0.2

1 Like