Skip to content

Commit bf8e503

Browse files
authored
[in_app_purchase] Updates handling of subscription price changes in README. (flutter#4643)
This PR updates the "Confirming subscription price changes" section in the README to match the new specifications in Android's billing client . Solves flutter#131248
1 parent 4e18b58 commit bf8e503

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

packages/in_app_purchase/in_app_purchase/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 3.1.8
2+
3+
* Updates documentation on handling subscription price changes to match Android's billing client v5.
4+
15
## 3.1.7
26

37
* Fixes unawaited_futures violations.

packages/in_app_purchase/in_app_purchase/README.md

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -239,40 +239,27 @@ InAppPurchase.instance
239239

240240
### Confirming subscription price changes
241241

242-
When the price of a subscription is changed the consumer will need to confirm that price change. If the consumer does not
243-
confirm the price change the subscription will not be auto-renewed. By default on both iOS and Android the consumer will
244-
automatically get a popup to confirm the price change, but App developers can override this mechanism and show the popup on a later moment so it doesn't interrupt the critical flow of the App. This works different for each of the stores.
242+
When the price of a subscription is changed the consumer will need to confirm
243+
that price change. If the consumer does not confirm the price change the
244+
subscription will not be auto-renewed. By default on both iOS and Android the
245+
consumer will automatically get a popup to confirm the price change. Depending
246+
on the platform there are different ways to interact with this flow as
247+
explained in the following paragraphs.
245248

246249
#### Google Play Store (Android)
247-
When the subscription price is raised, the consumer should approve the price change within 7 days. The official
248-
documentation can be found [here](https://support.google.com/googleplay/android-developer/answer/140504?hl=en#zippy=%2Cprice-changes).
249-
When the price is lowered the consumer will automatically receive the lower price and does not have to approve the price change.
250250

251-
After 7 days the consumer will be notified through email and notifications on Google Play to agree with the new price. App developers have 7 days to explain the consumer that the price is going to change and ask them to accept this change. App developers have to keep track of whether or not the price change is already accepted within the app or in the backend. The [Google Play API](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions) can be used to check whether or not the price change is accepted by the consumer by reading the `priceChange` property on a subscription object.
252-
253-
The `InAppPurchaseAndroidPlatformAddition` can be used to show the price change confirmation flow. The additions contain the function `launchPriceChangeConfirmationFlow` which needs the SKU code of the subscription.
254-
255-
```dart
256-
//import for InAppPurchaseAndroidPlatformAddition
257-
import 'package:in_app_purchase_android/in_app_purchase_android.dart';
258-
//import for BillingResponse
259-
import 'package:in_app_purchase_android/billing_client_wrappers.dart';
260-
261-
if (Platform.isAndroid) {
262-
final InAppPurchaseAndroidPlatformAddition androidAddition =
263-
_inAppPurchase
264-
.getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
265-
var priceChangeConfirmationResult =
266-
await androidAddition.launchPriceChangeConfirmationFlow(
267-
sku: 'purchaseId',
268-
);
269-
if (priceChangeConfirmationResult.responseCode == BillingResponse.ok){
270-
// TODO acknowledge price change
271-
}else{
272-
// TODO show error
273-
}
274-
}
275-
```
251+
When changing the price of an existing subscription base plan or offer,
252+
existing subscribers are placed in a legacy price cohort. App developers can
253+
choose to [end a legacy price cohort](https://developer.android.com/google/play/billing/price-changes#end-legacy)
254+
and move subscribers into the current base plan price. When the new
255+
subscription base plan price is lower, Google will notify the consumer via
256+
email and notifications. The consumer will start paying the lower price next
257+
time they pay for their base plan. When the subscription price is raised,
258+
Google will automatically start notifying consumers through email and
259+
notifications 7 days after the legacy price cohort was ended. It is highly
260+
recommended to give consumers advanced notice of the price change and provide a
261+
deep link to the Play Store subscription screen to help them review the price
262+
change. The official documentation can be found [here](https://developer.android.com/google/play/billing/price-changes).
276263

277264
#### Apple App Store (iOS)
278265

packages/in_app_purchase/in_app_purchase/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase
22
description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play.
33
repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 3.1.7
5+
version: 3.1.8
66

77
environment:
88
sdk: ">=2.18.0 <4.0.0"

0 commit comments

Comments
 (0)