8.1.0 - Advanced Commerce Data & Promoted Products
v8.1.0 introduces StoreKit 2's Advanced Commerce Data for iOS 15+ attribution tracking, improved promoted product handling, and the new google field for Android request parameters.
What's New
Advanced Commerce Data (iOS 15+)
StoreKit 2 introduces the Product.PurchaseOption.custom API for passing attribution data during purchases. This enables campaign tracking, affiliate marketing integration, and promotional code attribution.
import 'package:flutter_inapp_purchase/flutter_inapp_purchase.dart';
await iap.requestPurchaseWithBuilder(
build: (builder) {
builder.ios.sku = 'com.example.premium';
builder.ios.advancedCommerceData = 'campaign_summer_2025';
builder.type = ProductQueryType.InApp;
},
);
Use cases:
- Campaign attribution tracking
- Affiliate marketing integration
- Promotional code tracking
- Custom analytics data
The advancedCommerceData field is available in both RequestPurchaseIosProps and RequestSubscriptionIosProps.
Promoted Products Stream
The purchasePromoted stream provides a cleaner way to handle App Store promoted product purchases. When a user taps a promoted product in the App Store, this stream emits the product ID.
StreamSubscription<String?>? _promotedSubscription;
void setupPromotedListener() {
_promotedSubscription = iap.purchasePromoted.listen((productId) async {
if (productId != null) {
debugPrint('User tapped promoted product: $productId');
// Purchase using standard flow
await iap.requestPurchaseWithBuilder(
build: (builder) {
builder.ios.sku = productId;
builder.type = ProductQueryType.InApp;
},
);
}
});
}
void dispose() {
_promotedSubscription?.cancel();
super.dispose();
}
google Field Support (Android)
Android request parameters now support the google field, aligning with OpenIAP specification for consistent cross-platform naming.
// Recommended (new)
RequestPurchasePropsByPlatforms(
google: RequestPurchaseAndroidProps(skus: ['sku']),
);
// Deprecated (still works)
RequestPurchasePropsByPlatforms(
android: RequestPurchaseAndroidProps(skus: ['sku']),
);
Deprecated
requestPurchaseOnPromotedProductIOS()
This method is deprecated in favor of using the purchasePromoted stream with the standard requestPurchase() flow.
Before (deprecated):
await iap.requestPurchaseOnPromotedProductIOS();
After (recommended):
iap.purchasePromoted.listen((productId) async {
if (productId != null) {
await iap.requestPurchaseWithBuilder(
build: (builder) {
builder.ios.sku = productId;
builder.type = ProductQueryType.InApp;
},
);
}
});
android Field in Request Parameters
The android field in RequestPurchasePropsByPlatforms is deprecated. Use google instead for consistency with OpenIAP naming conventions.
Dependencies
Updated OpenIAP versions:
openiap-apple: 1.3.5 -> 1.3.7openiap-google: 1.3.14 -> 1.3.15openiap-gql: 1.3.5 -> 1.3.8
