Billing V5: change between 2 renewable base plans of the same subscription
See original GitHub issueI am migrating the Android Billing Library from V4 to V5 and I cannot use the method BillingClient#launchBillingFlow to change between 2 renewable base plans of the same subscription. It returns the error Error retrieving information from server. DF-DFERH-01
. Below is my implementation:
BillingFlowParams.SubscriptionUpdateParams subscriptionUpdateParams =
BillingFlowParams.SubscriptionUpdateParams.newBuilder()
.setOldPurchaseToken(oldPurchaseToken)
.build();
List<BillingFlowParams.ProductDetailsParams> productDetailsParams = new ArrayList<>();
productDetailsParams.add(BillingFlowParams.ProductDetailsParams.newBuilder()
.setProductDetails(productDetails)
.setOfferToken(offerToken)
.build());
BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
.setSubscriptionUpdateParams(subscriptionUpdateParams)
.setProductDetailsParamsList(productDetailsParams)
.build();
mBillingClient.launchBillingFlow(activity, billingFlowParams);
The official introduction about the new Billing structure mentioned the ability to change between 2 renewable base plans of the same subscription in their example:
In the PlayBillingCodelab sample app, when a user purchased a renewable plan, there is no option to upgrade/downgrade to another renewable plan in the same subscription. (PlayBillingCodelab MainActivity.kt line 127)
So which one is correct? In the new subscription structure, can the user change between 2 renewable base plans of the same subscription?
Issue Analytics
- State:
- Created a year ago
- Reactions:7
- Comments:9
Top GitHub Comments
@tuan25abc @SamYStudiO I faced the same issue. It is only possible to change base plan of the same subscription with the
ProrationMode.IMMEDIATE_WITHOUT_PRORATION
andProrationMode.IMMEDIATE_AND_CHARGE_FULL_PRICE
It is supported. It could be the fact that you didn’t set a proration mode or something is wrong with the tokens, the old token must be the purchase token of the existing subscription while the new token is the offer token. See https://github.com/android/play-billing-samples/blob/3f34105c34e2ed2e88055ccf2b04088e8a5fd3a2/ClassyTaxiAppKotlin/app/src/main/java/com/example/subscriptions/ui/BillingViewModel.kt#L145