On platforms that support it (Google Play and Universal Windows Applications, most notably), if you purchase something, uninstall, and then reinstall a game using Unity IAP, it automatically restores any products the user owns during the first initialization following reinstallation. For those on iOS, users must have the ability to restore their purchases via a button due to Apple requiring them to reauthenticate their password before it happens. Not doing so will prevent our game from being accepted on the iOS App Store, so it's a good idea to include this functionality if we wish to deploy there, as follows:
- Go to the Hierarchy window and select the Remove Ads button. Once selected, duplicate it by pressing Ctrl + D.
- Change the duplicate's name by selecting it and changing its name to Restore from Inspector.
- From the Hierarchy tab, open up the Text object and change the text to say Restore as well:

- Now, select the Restore object, and then in the IAP Button component, go to Button Type and select Restore:

You should note that the properties change to only have this type.
- Save your scene and jump into Unity:

When you start the game and try to click on the Restore button, you'll get a warning stating that this isn't a supported platform. So, with that in mind, we can adjust our game so that the button will only show up if we are currently running on a supported platform.
- Go to the Scripts folder and create a C# script called RestoreAdsChecker. Once it's opened, use the following script for it:
using UnityEngine;
using UnityEngine.Purchasing;
/// <summary>
/// Will show or remove a button depending on if we can restore /// ads or not
/// </summary>
public class RestoreAdsChecker : MonoBehaviour
{
// Use this for initialization
void Start()
{
bool canRestore = false;
switch (Application.platform)
{
// Windows Store
case RuntimePlatform.WSAPlayerX86:
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
// iOS, OSX, tvOS
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.tvOS:
canRestore = true;
break;
// Android
case RuntimePlatform.Android:
switch (StandardPurchasingModule.Instance().appStore)
{
case AppStore.SamsungApps:
case AppStore.CloudMoolah:
canRestore = true;
break;
}
break;
}
gameObject.SetActive(canRestore);
}
}
This script goes through all of the stores listed in Unity's IAPButton class, and if they are something that can be restored, we set canRestore to true, otherwise it will stay as false. Finally, we will remove the object if we cannot restore it, without having to create specific things for different builds.
- Save the script and dive back into Unity.
- Attach our newly created RestoreAdsChecker component to our Restore button.
- Save your project and start up the game:

On our PC build of the game, the Restore button doesn't show up, but if we export for iOS it will be on our device!