Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[in_app_purchase_android] Migrate to Google Play Billing Library 4.0
  • Loading branch information
abyesilyurt committed Apr 17, 2022
commit 4854bf29e5eb0cde8a8b5e68c9b7f88f0be20937
1 change: 1 addition & 0 deletions packages/in_app_purchase/in_app_purchase_android/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ Anton Borries <[email protected]>
Alex Li <[email protected]>
Rahul Raj <[email protected]>
Maurits van Beusekom <[email protected]>
Aziz Berkay Yesilyurt <[email protected]>
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0

* BREAKING CHANGE : Migrates to Google Play Billing Library 4.0.

## 0.2.2+3

* Migrates from `ui.hash*` to `Object.hash*`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ android {

dependencies {
implementation 'androidx.annotation:annotation:1.0.0'
implementation 'com.android.billingclient:billing:3.0.2'
implementation 'com.android.billingclient:billing:4.0.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.json:json:20180813'
testImplementation 'org.mockito:mockito-core:3.6.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,17 @@ private void launchBillingFlow(
paramsBuilder.setObfuscatedProfileId(obfuscatedProfileId);
}
if (oldSku != null && !oldSku.isEmpty()) {
paramsBuilder.setOldSku(oldSku, purchaseToken);
// The proration mode value has to match one of the following declared in
// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode
BillingFlowParams.SubscriptionUpdateParams.Builder subscriptionUpdateParamsBuilder =
BillingFlowParams.SubscriptionUpdateParams.newBuilder()
.setReplaceSkusProrationMode(prorationMode)
.setOldSkuPurchaseToken(oldSku);
paramsBuilder.setSubscriptionUpdateParams(
subscriptionUpdateParamsBuilder.build());

}
// The proration mode value has to match one of the following declared in
// https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode
paramsBuilder.setReplaceSkusProrationMode(prorationMode);

result.success(
Translator.fromBillingResult(
billingClient.launchBillingFlow(activity, paramsBuilder.build())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static HashMap<String, Object> fromPurchase(Purchase purchase) {
info.put("purchaseTime", purchase.getPurchaseTime());
info.put("purchaseToken", purchase.getPurchaseToken());
info.put("signature", purchase.getSignature());
info.put("sku", purchase.getSku());
info.put("sku", purchase.getSkus());
info.put("isAutoRenewing", purchase.isAutoRenewing());
info.put("originalJson", purchase.getOriginalJson());
info.put("developerPayload", purchase.getDeveloperPayload());
Expand All @@ -81,7 +81,7 @@ static HashMap<String, Object> fromPurchaseHistoryRecord(
info.put("purchaseTime", purchaseHistoryRecord.getPurchaseTime());
info.put("purchaseToken", purchaseHistoryRecord.getPurchaseToken());
info.put("signature", purchaseHistoryRecord.getSignature());
info.put("sku", purchaseHistoryRecord.getSku());
info.put("sku", purchaseHistoryRecord.getSkus());
info.put("developerPayload", purchaseHistoryRecord.getDeveloperPayload());
info.put("originalJson", purchaseHistoryRecord.getOriginalJson());
return info;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: in_app_purchase_android
description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs.
repository: https://github.com/flutter/plugins/tree/main/packages/in_app_purchase/in_app_purchase_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
version: 0.2.2+3
version: 0.3.0

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down