restorePurchases method

Future<void> restorePurchases({
  1. String? applicationUserName,
})

Restore all previous purchases.

The applicationUserName should match whatever was sent in the initial PurchaseParam, if anything. If no applicationUserName was specified in the initial PurchaseParam, use null.

Restored purchases are delivered through the purchaseStream with a status of PurchaseStatus.restored. You should listen for these purchases, validate their receipts, deliver the content and mark the purchase complete by calling the completePurchase method for each purchase.

This does not return consumed products. If you want to restore unused consumable products, you need to persist consumable product information for your user on your own server.

See also:

Implementation

Future<void> restorePurchases({String? applicationUserName}) =>
    InAppPurchasePlatform.instance.restorePurchases(
      applicationUserName: applicationUserName,
    );