purchasePackage static method

Future<PurchaserInfo> purchasePackage(
  1. Package packageToPurchase, {
  2. UpgradeInfo? upgradeInfo,
})

Makes a purchase. Returns a PurchaserInfo object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode(e) is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase.

packageToPurchase The Package you wish to purchase

upgradeInfo Android only. Optional UpgradeInfo you wish to upgrade from containing the oldSKU and the optional prorationMode.

Implementation

static Future<rc.PurchaserInfo> purchasePackage(rc.Package packageToPurchase,
    {rc.UpgradeInfo? upgradeInfo}) async {
  return rc.Purchases.purchasePackage(packageToPurchase,
      upgradeInfo: upgradeInfo);
}