Android Question Inapp Billing v5 - How to get subscription Price?

tufanv

Expert
Licensed User
Longtime User
Hello,

I have followed the instructions on Erel's billing v5 topic and here for subscription specific instructions.

This code gets the offer's details :

B4X:
Dim offers As List = SkuDetails.Get(0).As(JavaObject).RunMethod("getSubscriptionOfferDetails", Null)
Dim offer As JavaObject = offers.Get(0)
Log(offer.RunMethod("getOfferToken", Null))
Log(offer.RunMethod("getOfferTags", Null))
Log(offer.RunMethod("getPricingPhases", Null))

Last line returns something like this: com.android.billingclient.api.ProductDetails$PricingPhases@7ac8eb

How can I get the price of the subscription in local currency ?

As decribed here we need to use getformattedprice() after querying for the getPricingPhases. but I couldn't understand how to do it.
Related stackoverflow topic is here



It was like this before v5 :

B4X:
Public Sub GetAllProductPrice
    'make sure that the store service is connected
    Wait For (billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
    If Result.IsSuccess Then
        'get the sku details
        Dim sf As Object = billing.QuerySkuDetails("subs", Array("pro"))
        Wait For (sf) Billing_SkuQueryCompleted (Result As BillingResult, SkuDetailsList As List)
        If Result.IsSuccess And SkuDetailsList.Size > 0 Then
            Dim mp As Map
            mp.Initialize
            For Each Sku As SkuDetails In SkuDetailsList
                mp.Put(Sku.Sku, Sku.Price)
'                LogColor("SKU-Preis= " & Sku.Price,Colors.yellow)
                Main.urunfiyat="Aboneliği Başlat (" & Sku.Price&" / ay)"
             
            Next
   
        End If
    Else

    End If
End Sub
 
Last edited:
Top