Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[in_app_purchase] Update Play Billing library to 7.1.1 #8218

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/in_app_purchase/in_app_purchase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT

* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
* Updates `in_app_purchase_android` to 0.4.0.

## 3.2.0

Expand Down
4 changes: 2 additions & 2 deletions packages/in_app_purchase/in_app_purchase/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ the end user's payment account.
To upgrade/downgrade an existing in-app subscription in Google Play,
you need to provide an instance of `ChangeSubscriptionParam` with the old
`PurchaseDetails` that the user needs to migrate from, and an optional
`ProrationMode` with the `GooglePlayPurchaseParam` object while calling
`ReplacementMode` with the `GooglePlayPurchaseParam` object while calling
`InAppPurchase.buyNonConsumable`.

The App Store does not require this because it provides a subscription
Expand All @@ -232,7 +232,7 @@ PurchaseParam purchaseParam = GooglePlayPurchaseParam(
productDetails: productDetails,
changeSubscriptionParam: ChangeSubscriptionParam(
oldPurchaseDetails: oldPurchaseDetails,
prorationMode: ProrationMode.immediateWithTimeProration));
replacementMode: ReplacementMode.withTimeProration));
InAppPurchase.instance
.buyNonConsumable(purchaseParam: purchaseParam);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ class _MyAppState extends State<_MyApp> {
changeSubscriptionParam: (oldSubscription != null)
? ChangeSubscriptionParam(
oldPurchaseDetails: oldSubscription,
prorationMode:
ProrationMode.immediateWithTimeProration,
replacementMode:
ReplacementMode.withTimeProration,
)
: null);
} else {
Expand Down
10 changes: 10 additions & 0 deletions packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.4.0

* Updates Google Play Billing Library from 6.2.0 to 7.1.1.
* **BREAKING CHANGES**:
* Removes the deprecated `ProrationMode` enum. `ReplacementMode` should be used instead.
* Removes the deprecated `BillingClientWrapper.enablePendingPurchases` method.
* Bumps `minSdk` to 21.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a breaking change for in_app_purchase when rolling the dependency there; we strongly prefer not dropping OS support before the SDK itself.

In this case, Flutter 3.24+ only supports Android SDK 21+, so the way to make this change would be to update the plugin's min SDK version to 3.24, which makes this no longer a breaking change.

* Adds `installmentPlanDetails` to `SubscriptionOfferDetailsWrapper`.
* Adds APIs to support pending transactions for subscription prepaid plans (`PendingPurchasesParams`).

## 0.3.6+12

* Updates README to remove contributor-focused documentation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
compileSdk 34

defaultConfig {
minSdk 19
minSdk 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand Down Expand Up @@ -60,7 +60,7 @@ android {

dependencies {
implementation 'androidx.annotation:annotation:1.9.0'
implementation 'com.android.billingclient:billing:6.2.0'
implementation 'com.android.billingclient:billing:7.1.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20240303'
testImplementation 'org.mockito:mockito-core:5.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ interface BillingClientFactory {
* @param callbackApi The callback API to be used by the {@link BillingClient}.
* @param billingChoiceMode Enables the ability to offer alternative billing or Google Play
* billing.
* @param pendingPurchasesParams Parameters to enable pending purchases. See {@link
* com.android.billingclient.api.PendingPurchasesParams}.
* @return The {@link BillingClient} object that is created.
*/
BillingClient createBillingClient(
@NonNull Context context,
@NonNull Messages.InAppPurchaseCallbackApi callbackApi,
PlatformBillingChoiceMode billingChoiceMode);
PlatformBillingChoiceMode billingChoiceMode,
Messages.PlatformPendingPurchasesParams pendingPurchasesParams);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package io.flutter.plugins.inapppurchase;

import static io.flutter.plugins.inapppurchase.Translator.fromUserChoiceDetails;
import static io.flutter.plugins.inapppurchase.Translator.toPendingPurchasesParams;

import android.content.Context;
import androidx.annotation.NonNull;
Expand All @@ -21,8 +22,11 @@ final class BillingClientFactoryImpl implements BillingClientFactory {
public BillingClient createBillingClient(
@NonNull Context context,
@NonNull Messages.InAppPurchaseCallbackApi callbackApi,
PlatformBillingChoiceMode billingChoiceMode) {
BillingClient.Builder builder = BillingClient.newBuilder(context).enablePendingPurchases();
PlatformBillingChoiceMode billingChoiceMode,
Messages.PlatformPendingPurchasesParams pendingPurchasesParams) {
BillingClient.Builder builder =
BillingClient.newBuilder(context)
.enablePendingPurchases(toPendingPurchasesParams(pendingPurchasesParams));
switch (billingChoiceMode) {
case ALTERNATIVE_BILLING_ONLY:
// https://developer.android.com/google/play/billing/alternative/alternative-billing-without-user-choice-in-app
Expand Down
Loading
Loading