diff --git a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt index bdd71936..2dca5028 100644 --- a/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt +++ b/android/src/main/kotlin/com/dooboolab/flutterinapppurchase/AndroidInappPurchasePlugin.kt @@ -511,15 +511,14 @@ class AndroidInappPurchasePlugin internal constructor() : MethodCallHandler, if (offerTokenIndex != null) { offerToken = selectedProductDetails.subscriptionOfferDetails?.get(offerTokenIndex)?.offerToken } - if (offerToken == null) { + if (offerToken == null && selectedProductDetails.subscriptionOfferDetails != null) { offerToken = selectedProductDetails.subscriptionOfferDetails!![0].offerToken } - val productDetailsParamsList = - listOf(ProductDetailsParams.newBuilder() - .setProductDetails(selectedProductDetails) - .setOfferToken(offerToken) - .build()) + val details = ProductDetailsParams.newBuilder().setProductDetails(selectedProductDetails) + if (offerToken != null) + details.setOfferToken(offerToken) + val productDetailsParamsList = listOf(details.build()) builder.setProductDetailsParamsList(productDetailsParamsList) val params = SubscriptionUpdateParams.newBuilder() diff --git a/lib/modules.dart b/lib/modules.dart index a577a082..5096c968 100644 --- a/lib/modules.dart +++ b/lib/modules.dart @@ -117,7 +117,6 @@ class IAPItem { 'title: $title, ' 'description: $description, ' 'introductoryPrice: $introductoryPrice, ' - 'introductoryPricePaymentModeIOS: $introductoryPrice, ' 'subscriptionPeriodNumberIOS: $subscriptionPeriodNumberIOS, ' 'subscriptionPeriodUnitIOS: $subscriptionPeriodUnitIOS, ' 'introductoryPricePaymentModeIOS: $introductoryPricePaymentModeIOS, '