restorePurchases method
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 finishPurchase
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:
refreshPurchaseVerificationData
, for reloading failed PurchaseDetails.verificationData.
Implementation
Future<void> restorePurchases({String? applicationUserName}) =>
InAppPurchasePlatform.instance.restorePurchases(
applicationUserName: applicationUserName,
);