purchaseProduct static method

Future<PurchaserInfo> purchaseProduct(
  1. String productIdentifier, {
  2. UpgradeInfo? upgradeInfo,
  3. PurchaseType type = rc.PurchaseType.subs,
})

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.

productIdentifier The product identifier of the product you want to purchase.

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

type If the product is an Android INAPP, this needs to be PurchaseType.INAPP otherwise the product won't be found. PurchaseType.Subs by default. This parameter only has effect in Android.

Implementation

static Future<rc.PurchaserInfo> purchaseProduct(String productIdentifier,
    {rc.UpgradeInfo? upgradeInfo,
    rc.PurchaseType type = rc.PurchaseType.subs}) {
  return rc.Purchases.purchaseProduct(productIdentifier,
      upgradeInfo: upgradeInfo, type: type);
}