- Home /
Unity In-App Purchasing - Reset
Hey, is there currently a way to reinitialize/reset the Unity IAP once Initialize was already called? This is for a case where I need to change the items I added at first
Answer by nicholasr · Jul 26, 2016 at 06:47 PM
@davidb1 Adding items is possible with Unity 5.4's FetchAdditionalProducts
Deleting items is not possible, currently.
Would you mind sharing a description of the use-case for, if this is what is desired, deleting items from the IAP layer?
Fetching more products would work but it isn't the best solution, what if each of my users gets the products based on his "stats". If a user logs out and another logs in, I would want to get different products for this user.
Reseting the IAP would do the same but better - it would save me the check whether there are items that both users should be getting (which currently throws an exception when I try to add the same items twice)
A workaround for that case is building and maintaining a local intermediate copy of the per-user product list. Purge the list on log out. Use that list as the 'source of truth' ins$$anonymous$$d of Unity IAP's list of Product objects.
Thanks for sharing this reset "life cycle" use-case - we'll take it into consideration for a future upgrade to the Unity IAP API.
Problem is, since Unity IAP's product list can't be cleared and already has an item with the same store ID as the one I try to initialize, I will get an exception (Unity IAP's dictionary already contains that item).
So I have to remember locally which products I have already initialized with Unity IAP and which I haven't (users may have the same products so I have to avoid initializing the same products with Unity IAP more than once).
Your answer
Follow this Question
Related Questions
Unity In app purchases - non-consumable Duplicate Transaction on Android 1 Answer
FetchAdditionalProducts - Unity 5.4 1 Answer
in app purchase sooma restore option 1 Answer
unity3d google play error [DF-RPC-01] 1 Answer
In iOS, IAP With Sandbox User Works But It Fails With Non-Sandbox Users 0 Answers