I updated Google Play Billing to version 3, but SubscriptionManager is not supported. And now how to check subscription info? I am checking subscription when UnityIAP initalizing, and now i am getting nullrefexception.
About the topic of SubscriptionManager, I will be very transparent and very honest here, we updated SubscriptionManager to work with the IAP 2.2.0 but SubscriptionManager has it’s flaws and we know it’s a pain to use. No official word when we will change it or update it but I want you to know that we are aware of the usability issues.
Now how you are supposed to use the SubscriptionManager today, you must first initialise the SubscriptionManager with a product. You can get that product from the
StoreController.products
. Once initialized you can do something like this for example:
Code (CSharp):
SubscriptionManager subscriptionManager = new SubscriptionManager(product, null);
var isSubscribed = subscriptionManager.getSubscriptionInfo()?.isSubscribed();
You will have to create and initialise a SubscriptionManager for every product you want to use
getSubscriptionInfo()
on, hence the usability issue.
I want to reassure you that we are working hard on releasing more updates to IAP and are devoted to make a better developer experience over time but I can’t give you a timeline of when this specific issue will be fixed.
Hopefully this answers your questions and concerns
@MatthieuSmith_Unity3D hey, on “OnInitialized” when I try to get SubscriptionInfo by subscriptionManager.getSubscriptionInfo(), I get “UnityEngine.Purchasing.NullReceiptException”. Transaction is recorded, but receipt is always null,
Yes this is normal because OnInitialized isn’t when IAP retrieves the purchases from the store.
You are probably wondering “Ok well when can I call getSubscriptionInfo()?”
This got me thinking, which causes an investigation on my part and realized there is no event for when we retrieve the purchases from the stores. At least not one that you can bind to.
We are working on adding a OnPurchasesRetrieved to the IStoreController, we will be working on this soon but for now you have to use the Update() method from a MonoBehavior.
Isn’t IAPDemo.cs a little bit outdated now? checkIfProductIsAvailableForSubscriptionManager() is still looking for developerPayload field, which is gone with GPBL v3. Old transactions can still contain it, of course, but I think both variants should work fine in demo.
@MatthieuSmith_Unity3D
Could I know all valid Unity versions for Unity IAP 2.2.0 ?
I use Unity 2018.4.17f1 but, it doesn’t seem its PackageManager supports Unity IAP 2.2.0
Unity IAP 2.0.6 is the top on the list.
Is it essential to change my Unity Version?
Hey @lettuce_unity , yes this is normal we are pushing an update to PackageManager now. I can’t promise when it will be live but I will say it is extremely soon.
To clarify maybe some confusion, IAP uses both Asset Store and PackageManager. The Asset Store part is required to have a working IAP setup, it contains the store logic. You may be already using it without knowing it, when you completed the setup through the service window. The PackageManager is where the core logic of IAP plugin is located.
With the update of 2.2.0 to the PackageManager (UPM) we will be fixing some issues with receipts not being updated correctly with the update to 2.2.0 AssetStore.
This is probably more information that you wanted but I felt like I should clarify this before answering your question.
IAP supports Unity LTS 2018.4, 2019,4 and all Unity version for 2020.
Yes it is normal PackageManager doesn’t have a 2.2.0 update yet.
To verify if you IAP is up to date please check your In-App Purchasing service window, you can do this by opening your Unity Editor then clicking on Window/General/Services then you can double click on In-App Purchasing, in that window you should be able to see if there is an updated version available.
Hi, Is there any way to get the correct subscription expiry date, cancel date and purchase date using the subscription manager? We were testing our product with test products and were receiving incorrect times from the subscriptionmanager info object. The cancel time usually came up as 01/01/0001 and the expiry time was not matching that of the play store. I saw in some other thread that this would happen to test times, but I am hoping there is some way I can confirm that things will work correctly when I put into production.
@sanathkukkillaya Does this happen when you restart your app also, and when you wait 5-10 minutes as a test? We are pass through service only for the store APIs, this is the info they send to us.
@JeffDUnity3D Yes, this happens even when I restart the app. We have a requirement where we need to send an email to the user on Cancelling of subscription. So I usually quit the app and cancel the subscription from the play store. Then when I restart the app and login, we check the receipt and inform the back-end that the subscription is cancelled and also update the back end with the cancellation time and the expiry time. However this will give me the incorrect dates as I mentioned.
Just to understand, since you are using Google Play billing library 3 inside Unity IAP, aren’t you getting the expiryTimeMills from the billing library? Are you calculating these values based on the receipt? Or will this issue occur even if I use native Google billing library?