play billing library v3.0.3
and we handled subscription upgrade as code below.BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
.setSkuDetails(skuDetails)
.setOldSku(oldSKU, oldPurchaseToken)
.setReplaceSkusProrationMode(IMMEDIATE_WITH_TIME_PRORATION)
.build();
play billing library v4.0.0
thinking it would solve our issue.BillingFlowParams billingFlowParams = BillingFlowParams.newBuilder()
.setSubscriptionUpdateParams(SubscriptionUpdateParams.newBuilder()
.setOldSkuPurchaseToken(oldPurchaseToken)
.setOldSkuPurchaseId(oldSKU) // This method is not available in lib[4.0.0] but mentioned in docs
.setReplaceSkusProrationMode(IMMEDIATE_WITH_TIME_PRORATION))
.setSkuDetails(skuDetails)
.build();
play billing library v4.0.0
does not have method setOldSkuPurchaseId() in class SubscriptionUpdateParams.Builder but mentioned in developer docsError Screenshot Attached Below
I had to add an additional .build() to Google's example code
// Retrieve a value for "skuDetails" by calling querySkuDetailsAsync()
val flowParams = BillingFlowParams.newBuilder()
.setSubscriptionUpdateParams(SubscriptionUpdateParams.newBuilder()
.setOldSkuPurchaseToken(purchaseTokenOfOriginalSubscription)
.setReplaceSkusProrationMode(desiredProrationMode)
.build() // <-- MISSING BUILD
)
.setSkuDetails(upgradeOrDowngradeSkuDetails)
.build();
val responseCode = billingClient.launchBillingFlow(activity, flowParams)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With