Android Question Howto GooglePlayBilling Subscription Up/Downgrade?


Well-Known Member
Licensed User
Longtime User
In Google billing, subscription products were created for month, quarter and year.
The playstore setup and the testapp run smoothly and as expected.

Now the user should be able to upgrade or downgrade as described here


However, when upgrading or downgrading, you pass the product IDs for the current subscription and the future (upgraded or downgraded) subscription to the BillingFlowParams object using the setOldSku() method.

At this point it is unclear in which way the "setOldSku" can be achieved


B4X founder
Staff member
Licensed User
Longtime User
You can use this code to start the billing flow and set the old SKU:

'should be called from the activity
Sub LaunchBillingFlow(sku As SkuDetails, OldSku As String, PurchaseToken As String) As BillingResult
    Dim jo As JavaObject = Starter.billing
    Dim BillingClient As JavaObject = jo.GetField("client")
    Dim context As JavaObject
    Dim BillingFlowParams As JavaObject
    BillingFlowParams = BillingFlowParams.InitializeStatic("") _
                .RunMethodJO("newBuilder", Null).RunMethodJO("setSkuDetails", Array(sku)) _
                .RunMethodJO("setOldSku", Array(OldSku, PurchaseToken)).RunMethod("build", Null)
    Return BillingClient.RunMethod("launchBillingFlow", Array(context, BillingFlowParams))
End Sub
Last edited:
Upvote 0