Unity IAP SubscriptionManager getSubscriptionInfo NullReceiptException on Android

Hi,

I got NullReceiptException when I try to do getSubscriptionInfo().
I updated UnityIAP to the last version.

Do I need to subscribe to have subscriptionManger.getsubscriptioninfo working?

UnityIAP version 1.23.1
In App Purchasing 2.0.6

subscriptionDict = m_GoogleExtensions.GetProductJSONDictionary();
        string intro_json = (subscriptionDict == null || !subscriptionDict.ContainsKey(itemInfo[8].product.definition.storeSpecificId)) ? null : subscriptionDict[itemInfo[8].product.definition.storeSpecificId];
        SubscriptionManager subManager = new SubscriptionManager(subProduct, intro_json);
        subManager.getSubscriptionInfo();

Yes, you need to check to make sure the receipt is not null. You need a purchase first.

1 Like

Thanks a lot.

Hi again,

another question : how can I know if the player has access to the introductory period. In my tests, I don’t have any receipt when I am unsubscribed after the test period with the test approved card.

This may help Google Play Introductory Pricing - #14 by JeffDUnity3D

Bump, have the same issue

Please see my previous post, just before yours.

@JeffDUnity3D , if user cancels the subscription after subscribing it for some time. Do the method getSubscriptionInfo() will still return data or will throw exception ?

Please test and see. It should not throw an exception. However I believe the receipt will be empty.

Hi @JeffDUnity3D

getSubscriptionInfo().isSubscribed()

whats the point of adding isSubcribed if getSubcription going to throw null anyway if you are not already subscribed?
I want to understand the use case of this method.

Thanks

This should help https://discussions.unity.com/t/718780