I am trying to restore a non-consumable purchase on iOS using Unity-IAP.
I have only 1 IAP which is to remove ads. Apple request this can be restored and a button is required.
Below is the function I call on the button to restore purchases;
public void RestorePurchases()
{
// If Purchasing has not yet been set up …
if (!IsInitialized())
{
// … report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
Debug.Log(“RestorePurchases FAIL. Not initialized.”);
return;
}
// If we are running on an Apple device …
if (Application.platform == RuntimePlatform.IPhonePlayer ||
Application.platform == RuntimePlatform.OSXPlayer)
{
// … begin restoring purchases
Debug.Log(“RestorePurchases started …”);
// Fetch the Apple store-specific subsystem.
var apple = m_StoreExtensionProvider.GetExtension();
// Begin the asynchronous process of restoring purchases. Expect a confirmation response in
// the Action below, and ProcessPurchase if there are previously purchased products to restore.
apple.RestoreTransactions((result) => {
// The first phase of restoration. If no more responses are received on ProcessPurchase then
// no purchases are available to be restored.
Debug.Log("RestorePurchases continuing: " + result + “. If no further messages, no purchases available to restore.”);
// Should I restore the IAP here??? *****
});
}
How do I know if the restore has been complete ‘sucesfully’ ?
Do I assume it has been and insert my codes where I have written ‘// Should I restore the IAP here??? *****’ above?
Any suggestion would be great welcomed.
Thank you