Skip to main content

One post tagged with "bug-fix"

View All Tags

8.2.7 - iOS subscriptionOffers Fix

· One min read
Hyo
Maintainer of flutter_inapp_purchase & expo-iap

This release fixes a bug where subscriptionOffers was always null on iOS subscription products.

Bug Fixes

subscriptionOffers Parsing for iOS

Previously, ProductSubscriptionIOS.subscriptionOffers was always null even though the native OpenIAP layer returned the data correctly. This has been fixed by adding proper parsing logic in the Dart layer.

final subscriptions = await iap.fetchProducts<ProductSubscription>(
skus: ['premium_monthly'],
type: ProductQueryType.Subs,
);

for (final sub in subscriptions) {
if (sub is ProductSubscriptionIOS) {
// Now correctly populated
final offers = sub.subscriptionOffers;
if (offers != null) {
for (final offer in offers) {
print('Offer: ${offer.id}');
print('Type: ${offer.type}'); // introductory, promotional
print('Payment Mode: ${offer.paymentMode}'); // freeTrial, payAsYouGo, etc.
print('Price: ${offer.displayPrice}');
}
}
}
}

Installation

dependencies:
flutter_inapp_purchase: ^8.2.7