logInAppPurchase method

Future<void> logInAppPurchase({
  1. String? currency,
  2. bool? freeTrial,
  3. double? price,
  4. bool? priceIsDiscounted,
  5. String? productID,
  6. String? productName,
  7. int? quantity,
  8. bool? subscription,
  9. num? value,
})
inherited

Logs the standard in_app_purchase event.

This event signifies that an item(s) was purchased by a user.

This API is intended for manually logging in-app purchase events on iOS, particularly for purchases that occur in WebView or non-native billing flows. For StoreKit 2 transactions, use logTransaction instead.

Only available on iOS.

Implementation

Future<void> logInAppPurchase({
  String? currency,
  bool? freeTrial,
  double? price,
  bool? priceIsDiscounted,
  String? productID,
  String? productName,
  int? quantity,
  bool? subscription,
  num? value,
}) {
  if (defaultTargetPlatform != TargetPlatform.iOS) {
    throw UnimplementedError('logInAppPurchase() is only supported on iOS.');
  }
  return _delegate.logEvent(
    name: 'in_app_purchase',
    parameters: filterOutNulls(<String, Object?>{
      _CURRENCY: currency,
      _FREE_TRIAL: freeTrial,
      _PRICE: price,
      _PRICE_IS_DISCOUNTED: priceIsDiscounted,
      _PRODUCT_ID: productID,
      _PRODUCT_NAME: productName,
      _QUANTITY: quantity,
      _SUBSCRIPTION: subscription,
      _VALUE: value,
    }),
  );
}