- I would like to know what code I need to put into my game to show that a user owns previously purchased products.
You feel that you need to be able to detect and restore purchases via the code in your game if required.
App stores maintain a permanent record of each user’s Non-Consumable and Subscription products that Unity IAP can retrieve, and as such no further action is required.
Once product restoration has started (either automatically on Unity IAP initialization for Google Play or after the RestoreTransactions method has been called for iOS), Unity IAP's backend process will call the ProcessPurchase method via the IStoreListener on each item being restored. This means that, whatever code the app has for the first time a purchase is made, this code will be executed again for the purchases being restored.
On Apple platforms users must enter their password to retrieve previous transactions, so your application must provide users with a button allowing them to do so. During this process, the ProcessPurchase method of your IStoreListener will be invoked for any items the user already owns.
How does one differentiate between ProcessPurchase being called by a restore purchase and it being called by a new purchase?
Article is closed for comments.