LinkFive - Successful Subscriptions
Switch Subscription plan
Switch Subscription plan
When a user purchase a subscription, you may want to offer them to switch to a different subscription plan without cancelling the first subscription.
for example, a user purchased a 1 month subscription and after some time, the user likes your app and wants to switch to a 12-months subscription plan. Normally, the user has to cancel the first subscription and wait until the subscription ends. Then the user purchases the 12-months subscription. But instead of canceling the old subscription, you can offer them to switch immediately without waiting.
In this case you should switch the subscription plan.
The Switch Subscription Plan Function
To switch from one plan to another, you need to know from which plan you want to switch from. In our case, you can just submit what the LinkFivePurchases gives you on activeProducts.
Then just call switchPlan( ... )
LinkFivePurchases.switchPlan( oldPurchasePlan, // old plan linkFiveProductDetails, // new subscription prorationMode: ProrationMode.immediateWithTimeProration);
- oldPurchasePlan: is from LinkFivePurchases.activeProducts and is the current active Subscription which you want to end.
- linkFiveProductDetails: is coming from LinkFivePurchases.products. This is the NEW subscription plan which should be active.
- prorationMode: is can also be null! The proration mode is Google only: the default replaces immediately the subscription, and the remaining time will be prorated and credited to the user. Check https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.ProrationMode for more information
After success, the new plan should be either active immediately or after the subscription period os over (depending on your mode).