ReadyForPromotedProductPurchaseListener typedef

ReadyForPromotedProductPurchaseListener = void Function(String productIdentifier, Future<PromotedPurchaseResult> startPurchase())

iOS Only Listener called when a user initiates a promoted in-app purchase from the App Store. If your app is able to handle a purchase at the current time, run the startPurchase block in this method. If the app is not in a state to make a purchase: cache the startPurchase block, then call the startPurchase block when the app is ready to make the promoted purchase.

If the purchase should never be made, you don't need to ever call the block and the plugin will not proceed with the promoted purchase.

This can be tested by opening a link like: itms-services://?action=purchaseIntent&bundleId=<BUNDLE_ID>&productIdentifier=<SKPRODUCT_ID>

  • Parameter productIdentifier: the productIdentifier associated with the promoted purchase
  • Parameter startPurchase: call this block when the app is ready to handle the purchase

Implementation

typedef ReadyForPromotedProductPurchaseListener = void Function(
  String productIdentifier,
  Future<PromotedPurchaseResult> Function() startPurchase,
);