restorePurchases

abstract fun restorePurchases(completion: (RestorationResult, Throwable?) -> Unit)(source)

Called when the user initiates a restore.

Add your restore logic here, making sure that the user's subscription status is updated after restore, and call the completion lambda.

  • Parameters:

  • completion: A lambda that accepts two objects. 1. A RestorationResultJava that's .restored if the user's purchases were restored or .failed if they weren't. 2. An optional error that you can return when the restore failed. Note: restored does not imply the user has an active subscription, it just mean the restore had no errors.