- Home /
Clear All Purchases in Unity IAP
I'm trying to make a "Clear Player Data" button in my game, and I'd like clear all the purchases the player made through the Unity IAP API. This way, if they press "Restore Purchases" right after, they would be able receive them back again. This being an alternative from them deleting/re-installing the app.
I noticed UnityPurchasing.ClearTransactionLog(), (https://docs.unity3d.com/ScriptReference/Purchasing.UnityPurchasing.ClearTransactionLog.html) but the documentation notes it should only be used for testing.
Is there a more official way to do this?
I'm using the latest version of Unity's IAP API (as of January 22, 2017). Unity 5.5.0f3.
In the end, I just removed the "Clear Player Data" button. $$anonymous$$y game isn't one where people would want to clear their data very often I reason.
Answer by nasir_41 · Feb 03, 2017 at 07:58 AM
It totally depends on how you storing the purchased items if you storing them in Player prefs then simply clear the player prefs.
When user will call the restore purchases again then all the No-Consumable Items will be restored by this Unity InApp API again.
So calling RestorePurchases() restores all purchases regardless if they have already been restored?
I suppose I'd need some logic to check if they already restored purchases to avoid calling it again.