Skip to content

Commit e8f1f63

Browse files
authored
[in_app_purchase] Update Play Billing library to 7.1.1 (#8218)
Updates Play Billing Library to the latest version 7.1.1. Exposes new APIs as per [release notes](https://developer.android.com/google/play/billing/release-notes): - Adds Dart representation of `ProductDetails.InstallmentPlanDetails` - Adds Dart representation of `PendingPurchasesParams` and removes the deprecated `enablePendingPurchases` method on `BillingClientWrapper` (breaking change) - Adds Dart representation of `Purchase.PendingPurchaseUpdate` - Removes the deprecated `ProrationMode` as it has been removed from the native library (breaking change) This PR introduces breaking changes in `in_app_purchase_android`, but does not introduce any breaking changes on the platform interface level. Fixes flutter/flutter#147394
1 parent 6dee381 commit e8f1f63

File tree

51 files changed

+1630
-1935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1630
-1935
lines changed

packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 0.4.0
2+
3+
* Updates Google Play Billing Library from 6.2.0 to 7.1.1.
4+
* **BREAKING CHANGES**:
5+
* Removes the deprecated `ProrationMode` enum. `ReplacementMode` should be used instead.
6+
* Removes the deprecated `BillingClientWrapper.enablePendingPurchases` method.
7+
* Removes JSON serialization from Dart wrapper classes.
8+
* Removes `subscriptionsOnVR` and `inAppItemsOnVR` from `BillingClientFeature`.
9+
* Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper`.
10+
* Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchasesParams`).
11+
112
## 0.3.6+13
213

314
* Updates androidx.annotation:annotation to 1.9.1.

packages/in_app_purchase/in_app_purchase_android/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ android {
3131
compileSdk 34
3232

3333
defaultConfig {
34-
minSdk 19
34+
minSdk 21
3535
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3636
}
3737
lintOptions {
@@ -60,7 +60,7 @@ android {
6060

6161
dependencies {
6262
implementation 'androidx.annotation:annotation:1.9.1'
63-
implementation 'com.android.billingclient:billing:6.2.0'
63+
implementation 'com.android.billingclient:billing:7.1.1'
6464
testImplementation 'junit:junit:4.13.2'
6565
testImplementation 'org.json:json:20250107'
6666
testImplementation 'org.mockito:mockito-core:5.4.0'

packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ interface BillingClientFactory {
1919
* @param callbackApi The callback API to be used by the {@link BillingClient}.
2020
* @param billingChoiceMode Enables the ability to offer alternative billing or Google Play
2121
* billing.
22+
* @param pendingPurchasesParams Parameters to enable pending purchases. See {@link
23+
* com.android.billingclient.api.PendingPurchasesParams}.
2224
* @return The {@link BillingClient} object that is created.
2325
*/
2426
BillingClient createBillingClient(
2527
@NonNull Context context,
2628
@NonNull Messages.InAppPurchaseCallbackApi callbackApi,
27-
PlatformBillingChoiceMode billingChoiceMode);
29+
PlatformBillingChoiceMode billingChoiceMode,
30+
Messages.PlatformPendingPurchasesParams pendingPurchasesParams);
2831
}

packages/in_app_purchase/in_app_purchase_android/android/src/main/java/io/flutter/plugins/inapppurchase/BillingClientFactoryImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package io.flutter.plugins.inapppurchase;
66

77
import static io.flutter.plugins.inapppurchase.Translator.fromUserChoiceDetails;
8+
import static io.flutter.plugins.inapppurchase.Translator.toPendingPurchasesParams;
89

910
import android.content.Context;
1011
import androidx.annotation.NonNull;
@@ -21,8 +22,11 @@ final class BillingClientFactoryImpl implements BillingClientFactory {
2122
public BillingClient createBillingClient(
2223
@NonNull Context context,
2324
@NonNull Messages.InAppPurchaseCallbackApi callbackApi,
24-
PlatformBillingChoiceMode billingChoiceMode) {
25-
BillingClient.Builder builder = BillingClient.newBuilder(context).enablePendingPurchases();
25+
PlatformBillingChoiceMode billingChoiceMode,
26+
Messages.PlatformPendingPurchasesParams pendingPurchasesParams) {
27+
BillingClient.Builder builder =
28+
BillingClient.newBuilder(context)
29+
.enablePendingPurchases(toPendingPurchasesParams(pendingPurchasesParams));
2630
switch (billingChoiceMode) {
2731
case ALTERNATIVE_BILLING_ONLY:
2832
// https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app

0 commit comments

Comments
 (0)