Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[in_app_purchase] Add support to cross-grade a subscription on Android #2724

Closed
wants to merge 1 commit into from

Conversation

lexor90
Copy link

@lexor90 lexor90 commented Apr 29, 2020

This change introduces basic support to replace an old subscription on
Android. On iOS passing the added parameter will have no effect.

Please note that the current implementation is basic, in that it misses
a way to contextually change the proration mode.

It also uses setOldSku(string) rather than setOldSku(string, string)
which also requires the old purchaseToken to be provided.

Ref: https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setoldsku

Description

Hi, I’ve done a basic implementation to support Android subscription cross grades.

Note that this is a basic implementation in that it doesn’t support customizing the proration mode while changing the subscription. It also uses the deprecated method setOldSku(string). In order to use the new setOldSku(string, string) method we should add another parameter to accept the "purchaseToken", which seemed too invasive with regards to the iOS counterpart which doesn’t need that information as cross-grades are managed by the storefront through the concept of groups. I'm open to suggestions to add support for custom proration mode and to use the new suggested setSku(string, string) method.

I preferred the deprecated method in order to keep the change as simple as possible while achieving what most apps need. On iOS passing the added oldProduct parameter will have no effect.

Related Issues

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

This change introduces basic support to replace an old subscription on
Android. On iOS passing the added parameter will have no effect.

Please note that the current implementation is basic, in that it misses
a way to contextually change the proration mode.

It also uses `setOldSku(string)` rather than `setOldSku(string, string)`
which also requires the old purchaseToken to be provided.

Ref: https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setoldsku
@cacianokroth
Copy link

👁️

1 similar comment
@Ainiuso
Copy link

Ainiuso commented Jun 3, 2020

👁️

@cacianokroth
Copy link

Any predictions or answers for this PR?

@TrueNight
Copy link

I have already checked this functionality, it works like a charm!

@lexor90
Copy link
Author

lexor90 commented Mar 8, 2021

Closing in favour of #2822 that got merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants