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

Upgrade/Sidegrade/Downgrade subscriptions #192

Closed
wants to merge 3 commits into from

Conversation

nexxuno
Copy link

@nexxuno nexxuno commented Nov 21, 2018

Please take a moment to fill out the following:

Fixes #26 .

Changes Proposed in this pull request:
-aidl updated to latest version
-new method that makes sense only for android becuase upgrading downgrading on apple is supported natively in the store
-added new method to doc

@nexxuno
Copy link
Author

nexxuno commented Nov 22, 2018

There is a little typo in the UWP implementation which exception should say that Windows store doesn't support upgrades at the moment.

@nexxuno
Copy link
Author

nexxuno commented Jan 15, 2019

hi @jamesmontemagno , are you still working on this plugin or is it on hold? Maybe there are plans of integrating this in Essentials that I don't know of?

@jamesmontemagno
Copy link
Owner

No plans on Essentials integration as it is tricky with payments and isn't a good fit. I will add this to my backlog to test. Any changes you want to make @nexxuno ?

@nexxuno
Copy link
Author

nexxuno commented Jan 16, 2019

I've fixed a string typo. It should be good now.

Thanks.

@jamesmontemagno
Copy link
Owner

Is there no API to do this on iOS?

@StefAnglr
Copy link

Apple handles it on the backend with their "Subscription Groups," no device-side implementation necessary.

@nexxuno
Copy link
Author

nexxuno commented Jan 17, 2019 via email

@adamzucchi
Copy link

@nexxuno & @jamesmontemagno - Any idea when this is likely to be released?

@Gabriel1786
Copy link

I need this, when will this be made available?

@Zomby2D
Copy link

Zomby2D commented Mar 29, 2019

I needed it as well so I had to use the plugin's source projects in my solution instead of the Nuget package.
I also needed to disable proration in some cases, which led me to add an optional "proration" parameter

@adamzucchi
Copy link

Hello @nexxuno -
First thank you for contributing the PR for upgrades/downgrades. I've been playing with this branch for the upgrade/downgrade of subscriptions and have a question. Between iOS and Android I'm not sure what property or properties one can use to determine if a subscription is 'current' or the active subscription?

For example on Android the 'AutoRenewing' property does get set to true after a purchase however after upgrading to a different subscription the previous in-app product that was purchased is still marked as AutoRenewing true as well? On iOS AutoRenewing is always returned as false.

The PurchaseState property is another property I've been investigating and on Android this property is showing as PaymentPending for all previously purchased subscriptions and on iOS this property is showing as Purchased for all previously purchased subscriptions.

Any thoughts/ideas on this? Again just looking for the simplest way to determine what subscription is the active subscription for a user after numerous subscriptions have been purchased (whether upgraded or downgraded).

Thanks in advance!

@nexxuno
Copy link
Author

nexxuno commented Apr 17, 2019

Hi @adamzucchi ,
I'm using this
var owned = (await inAppBilling.GetPurchasesAsync(ItemType.Subscription)).SingleOrDefault(x => x.State != PurchaseState.Refunded);

and I didn't notice any problem.

@adamzucchi
Copy link

@nexxuno - Thank you for the reply!

I'm excited to try this approach with our next build and release : )

@yuv4ik
Copy link

yuv4ik commented Apr 24, 2019

@jamesmontemagno any plans on accepting this PR and making it available on NuGet?

@adamzucchi
Copy link

@nexxuno (cc @jamesmontemagno ) - I wanted to update you on my progress testing this PR. First thanks @nexxuno for posting this PR!

Earlier in this thread I asked @nexxuno how to get the current/active subscription for a user. He suggested the following:

var owned = (await inAppBilling.GetPurchasesAsync(ItemType.Subscription)).SingleOrDefault(x => x.State != PurchaseState.Refunded);

The issue I ran into with this is that multiple subscriptions at a time may evaluate to true which throws an exception - especially if you have multiple subscription groups that you've made purchases from. So I am having to do some custom sorting/filtering (to narrow the subscriptions I get returned to a single subscription group) and am using FirstOrDefault instead of SingleOrDefault.

My other piece of feedback is around the following use case example. Within a subscription group, if I purchase the least valuable subscription, upgrade to the next highest value subscription, and then attempt to downgrade to the previously purchased least valuable, I am experiencing some strange behavior. On iOS I get a "You're all set..." message which makes you think everything processed fine, however an exception is thrown by the plugin with error code 0 that it could not connect to the store.

After some research I found the following Apple forum post:
https://forums.developer.apple.com/thread/112663

From what I understand of this, this is actually the expected behavior from Apple? It appears Apple keeps you on the higher subscription and only takes you down the the downgraded subscription once the higher subscription runs out. Can anyone think of a way the plugin could handle this scenario more elegantly?

Has anyone else here experienced this? Have a solution?

Thanks in advance - and please let me know if you need further descriptions of any of this. I'd be happy to hop on a screen share and try to get this fixed/tested for the plugin.

Thanks!

Adam

@nexxuno
Copy link
Author

nexxuno commented May 1, 2019

Hi Adam,
Everything you are reporting is correct but it fits my business use cases. What I mean is that, as per design of my business logics, I imposed that A a user cannot but more than one subscrption, B cannot downgrade so I show them only sidegrades/upgrades. While the first condition may not fit your use case (and your solution is obviously correct), the second condition should be applicable for you too, just don't let your users downgrade their service level, if they want to they'll do that at the end of their current subscription period.

@StefAnglr
Copy link

Any hope of getting this merged?

@StefAnglr
Copy link

Guess that's a no?

@jamesmontemagno
Copy link
Owner

We will need to re-base this off the new master where I use the new NuGet for google play billing.

@WouterStraver
Copy link

Is this still planned to release any time soon?

@InquisitorJax
Copy link

+1 on waiting for this guy - so sad this is moving so slow :(

@WorldOfBasti
Copy link

WorldOfBasti commented Nov 14, 2020

Will this be added soon?

@mnxamdev
Copy link

Any thoughts on getting this merged in? Looks like there are merge conflicts. We could really use the Android subscription upgrade ability.

@jamesmontemagno
Copy link
Owner

It would be need to be re-based and re-implemented against latest APIs. iOS/UWP should be similar, Android I am not sure.

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

Successfully merging this pull request may close these issues.

[Feature Request] Ability to Upgrade/Downgrade Subscriptions