Restore purchases
Enable players to regain access to eligible products they already own when they reinstall your app, switch devices, or change platforms.
The Restore purchases feature allows players to access previously owned non-consumable products and active, renewable subscriptions without paying again. App stores maintain a permanent record of these entitlements, and Unity IAP can retrieve them to grant access.
Non-renewable subscriptions on Apple platforms can't be restored. If you use non-renewable subscriptions on Apple, you must maintain your own subscription records and synchronize entitlements across devices.
Google Play
- After reinstall, Unity IAP restores owned products on the first
StoreController.FetchPurchases()call. - IAP invokes the
OnPurchasesFetchedlistener with anOrdersobject that includes all purchases (all states). - If the
PurchaseService.ProcessPendingOrdersOnPurchasesFetchedsetting is set to true, IAP invokes theOnPurchasePendinglistener for each unfulfilled purchase. - Subsequent
FetchPurchases()calls in the same session don't triggerOnPurchasePendingfor orders that are already seen by the developer in the same session.
Apple platforms
- You must provide a Restore Purchases button (mandatory by Apple).
- The button calls
PurchaseService.RestoreTransactionswhich requests a transaction resync from Apple to resync transactions and may prompt the user to authenticate. - After resync, Unity IAP calls
FetchPurchasesand invokesOnPurchasesFetchedwith all transactions for the user.
Restore purchases (Apple platforms)
void RestorePurchases()
{
UnityIAPServices.StoreController().RestoreTransactions((success, error) =>
{
if (success) {
// This does not mean anything was restored,
// merely that the restoration process succeeded.
} else {
// Restoration failed. `error` contains the failure reason.
}
});
}