androidgoogle-playin-app-billingin-app-subscription

In App billing v5 Wrong pricing in Android


I'm using InAppbilling v5 in Android to retrieve the price of the Items, everything is working correctly, however when "Google" review my app they rejected because I'm not following the Subscription guidelines. In my test the price is retrived correctly but for in the Screenshots of Google there is a "Free", formatted price string instead $9.00 so I'm not sure how to fix this issue because apparently only happens when Google review my app. I'm using the following code to retrieve the products

   billingClient.queryProductDetails(
                        subscriptions.toQueryProduct(ProductType.SUBS)
                    ).productDetailsList

Then I'm retrieving the offer details like this:

val price = productDetails.subscriptionOfferDetails
                                ?.firstOrNull()
                                ?.pricingPhases?.pricingPhaseList
                                ?.firstOrNull()
                                ?.formattedPrice ?: ""

In my devices and emulator works correctly displaying the correct price, however for google it display "free" as formattedPrice How I can solve this? In my Subscriptions in the Play Store console I have only one price/base offer with a 7 days free trial.


Solution

  • I found the issue, the problem was that in the new version v5 if the user never had any subscription there will be 2 phases, the "free" trial which price is free and the subscription price after trial, I tested with my user and since I already had any subscription the "free" was not available, but for new users that never had any subscription there was a free opion. for now in my code I'm filtering the free with this code

     // there can be several pricingPhases and trial can be "free"
                                val formattedPrice = offerDetails?.pricingPhases
                                    ?.pricingPhaseList
                                    ?.firstOrNull { it.priceAmountMicros > 0 }
                                    ?.formattedPrice
    
    

    using it.priceAmountMicros > 0 will filter any item that is not "free" or has a price