purchaseDiscountedPackage static method
- @Deprecated('Use purchase(PurchaseParams)')
- Package packageToPurchase,
- PromotionalOffer promotionalOffer
iOS only. Purchase a package applying a given promotional offer.
Returns a PurchaseResult object. Throws a PlatformException if the purchase is unsuccessful. Check if PurchasesErrorHelper.getErrorCode is PurchasesErrorCode.purchaseCancelledError to check if the user cancelled the purchase.
packageToPurchase The Package you wish to purchase
promotionalOffer Promotional offer that will be applied to the product.
Retrieve this offer using getPromotionalOffer.
Implementation
@Deprecated('Use purchase(PurchaseParams)')
static Future<PurchaseResult> purchaseDiscountedPackage(
Package packageToPurchase,
PromotionalOffer promotionalOffer,
) async {
final purchaseResult =
await _invokeReturningPurchaseResult('purchasePackage', {
'packageIdentifier': packageToPurchase.identifier,
'presentedOfferingContext':
packageToPurchase.presentedOfferingContext.toJson(),
'signedDiscountTimestamp': promotionalOffer.timestamp.toString(),
});
return purchaseResult;
}