Restore purchases in mobile app in Android SDK

Restoring Purchases is a feature that allows users to regain access to previously purchased content, such as subscriptions or in-app purchases, without being charged again. This feature is especially useful for users who may have uninstalled and reinstalled the app or switched to a new device and want to access their previously purchased content without paying again.

Note

In paywalls built with Paywall Builder, purchases are restored automatically without additional code from you. If that’s your case — you can skip this step.

To restore a purchase if you do not use the Paywall Builder to customize the paywall, call .restorePurchases() method:

Response parameters:

ParameterDescription
Profile

An AdaptyProfile object. This model contains info about access levels, subscriptions, and non-subscription purchases.

Сheck the access level status to determine whether the user has access to the app.

Info

In Adapty Android SDK 4.0.2 and later, restorePurchases() completes successfully even when there is nothing to restore: it returns the current profile, so check the access level status in it. In earlier SDK versions, the method fails with the NO_PURCHASES_TO_RESTORE error in this case.

What can be restored

restorePurchases recovers active subscriptions and non-consumed one-time purchases from Google Play.

In Adapty Android SDK 4.0.2 and later, which uses Google Play Billing Library 8, the Play Store no longer returns expired subscriptions or consumed one-time purchases. To let users recover those across devices and reinstalls, identify them with Adapty.identify. Adapty then restores the purchase history from its backend instead of from the store.

Note

Google Play reports only currently owned purchases, so restorePurchases() can’t find subscriptions that expired before you integrated Adapty. To add them to Adapty, import your historical data.

Want to see a real-world example of how Adapty SDK is integrated into a mobile app? Check out our sample apps, which demonstrate the full setup, including displaying paywalls, making purchases, and other basic functionality.