purchaseDiscountedProduct static method
Future<CustomerInfo>
purchaseDiscountedProduct(
- StoreProduct product,
- PromotionalOffer promotionalOffer
iOS only. Purchase a product applying a given promotional offer.
Returns a CustomerInfo
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
static Future<CustomerInfo> purchaseDiscountedProduct(
StoreProduct product,
PromotionalOffer promotionalOffer,
) async {
final customerInfo = await _invokeReturningCustomerInfo('purchaseProduct', {
'productIdentifier': product.identifier,
'signedDiscountTimestamp': promotionalOffer.timestamp.toString(),
'presentedOfferingIdentifier':
product.presentedOfferingContext?.offeringIdentifier,
});
return customerInfo;
}