[iOS&Android] Questions regarding to restoring purchases

Hello,

I use the IAPDemo.cs from Sample IAP Project.

I would like to add some visual effects when player buys the inapp first time. If he already bought the inapp or press the restore button I would like not to play the visuals. I have some problems in understanding below scenarios.

iOS:
I have bought several non-consumable inapps on my first device. On my second device I try to buy the inapp which I have already bought on my first device. I will probably get the information that I already bought it. Will the UnityIAP restore this inapp and all others (will it call restore method same as I pushed programmed restore button?) or only the one I tried to buy again? How can I reach the information that this purchase is not a first one but “repeated”?

Next question is regarding to restore process. I would like to inform my game that the restore process has started and finished. If I fire a restore purchases button, I would like to setup a bool flag that the restoreProcess is started (is there any callback on restore start?) → go through purchase process of all bought inapps → set restoreProcess to false in OnTransactionsRestored method?

Android:
As far as I understand I can setup a flag in the Awake method (where the UnityIAP is initialized in the Sample IAP Project). All already bought inapps will get restored and then the OnInitialized method gets called and I can setup the flag to false?

@applicattura For iOS, RestoreTransactions will return after all ProcessPurchase restore operations are done. So you could set your boolean just before calling it, and clear it when it completes. For Android, there is no such method, Restore is (currently) automatic. You would need to set the boolean behind each of your purchase buttons. The boolean logic would be “If there has been no button click, it’s a restore”. We are looking to improve this in a future release Unity - Manual: Restoring Transactions

1 Like

Thank You for your detailed resposne. I came to a solution You mentioned (logic behind the button click), though the improvement would be awesome.