Skip to main content

Restoring Purchases

Restoring purchases is a mechanism by which your user can restore their in-app purchases, reactivating any content that had previously been purchased from the same store account (Apple, Google, or Amazon).

It is recommended that all apps have some way for users to trigger the restorePurchases method, even if you require all customers to create accounts.

Purchases.shared.restorePurchases { customerInfo, error in
// ... check customerInfo to see if entitlement is now active
}

The restorePurchases method should not be triggered programmatically, since it may cause OS level sign-in prompts to appear, and should only be called from some user interaction (e.g. tapping a "Restore" button.)

โš ๏ธ

If you are trying to restore a purchase programmatically, use syncPurchases instead. This will not cause OS level sign-in prompts to appear.

Restore behaviorโ€‹

When a user restores purchases that are already attached to another user, RevenueCat will decide whether to transfer the purchase to the new user based on the transfer behavior setting.

Syncing purchases without user interactionโ€‹

syncPurchases is a method we provide in our SDK which allows you to programmatically trigger a restore. This method, much like restorePurchases, reactivates any content that had previously been purchased from the same store account (Apple, Google, or Amazon).

Considerationsโ€‹

  • syncPurchases is typically used for migrating subscriptions
  • Since this method simulates restoring a purchase, there is a risk of transferring or aliasing an anonymous user

Restoring Purchases for Consumables and Non-renewing Subscriptionsโ€‹

Consumables and non-renewing subscriptions can only be restored by using an acount system with custom App User IDs. This is due to these types of in-app purchases not showing up on the underlying store receipt after the transaction is finished.

By logging in your users with a custom App User ID, RevenueCat can continue to provide transaction details in a user's CustomerInfo for their previous consumable and non-renewing subscription purchases.

Next Stepsโ€‹