purchaseDiscountedPackage static method
Future<CustomerInfo>
purchaseDiscountedPackage(
- Package packageToPurchase,
- PromotionalOffer promotionalOffer
iOS only. Purchase a package 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.
packageToPurchase
The Package you wish to purchase
promotionalOffer
Promotional offer that will be applied to the product.
Retrieve this offer using getPromotionalOffer.
Implementation
static Future<CustomerInfo> purchaseDiscountedPackage(
Package packageToPurchase,
PromotionalOffer promotionalOffer,
) async {
final customerInfo = await _invokeReturningCustomerInfo('purchasePackage', {
'packageIdentifier': packageToPurchase.identifier,
'offeringIdentifier': packageToPurchase.offeringIdentifier,
'signedDiscountTimestamp': promotionalOffer.timestamp.toString(),
});
return customerInfo;
}