purchaseDiscountedProduct static method
- @Deprecated('Use purchase(PurchaseParams)')
- StoreProduct product,
- PromotionalOffer promotionalOffer
iOS only. Purchase a product 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.
storeProduct The product 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> purchaseDiscountedProduct(
StoreProduct product,
PromotionalOffer promotionalOffer,
) async {
final purchaseResult =
await _invokeReturningPurchaseResult('purchaseProduct', {
'productIdentifier': product.identifier,
'signedDiscountTimestamp': promotionalOffer.timestamp.toString(),
'presentedOfferingIdentifier':
product.presentedOfferingContext?.offeringIdentifier,
});
return purchaseResult;
}