Google Play In-app Billing API version is less than 3 with updated Play Store
Asked Answered
V

0

22

I'm using the Google Play Billing Library to offer some in-app purchases in my app. Everything is working correctly, but I'm receiving the error "Google Play In-app Billing API version is less than 3" on Crashlytics from some users, mainly using Samsung devices.

I've searched for similar issues and I found out that it can be caused either by having an outdated version of the Google Play Store installed or by not beign logged in with the Google account. The problem is that in many of the cases reported, the installed Play Store version is up-to-date and the account is correctly signed-in, because the first connection to the Billing Service is successfull.

For example, a user that had installed version 20.39.15 of Play Services and 22.4.29-21 of Play Store, had this kind of error flow:

  • Instantiate BillingClient
  • Call billingClient.startConnection
  • Received callback onBillingSetupFinished with response code OK
  • Query purchases and get successfull response

Then after a few seconds:

  • Received 3 calls to onBillingServiceDisconnected (this method does nothing in my implementation)
  • Received a call to onBillingSetupFinished with responseCode 3 and debugMessage: "Google Play In-app Billing API version is less than 3"

This is part of the code I'm using, I've omitted the logging for clarity:

class BillingManager(
    private val application: Application
) : PurchasesUpdatedListener, BillingClientStateListener {

...

    init {
        billingClient = BillingClient.newBuilder(application.applicationContext)
                .enablePendingPurchases()
                .setListener(this)
                .build()
        connectToPlayBillingService()
    }

    private fun connectToPlayBillingService() {
        if (!billingClient.isReady) {
            billingClient.startConnection(this)
        }
    }

    override fun onBillingSetupFinished(billingResult: BillingResult) {
        if (billingResult.responseCode == BillingResponseCode.OK) {
            queryPurchasesAsync()
        } else {
            handleBillingException(BillingException("Billing connection error", billingResult))
        }
    }

   override fun onBillingServiceDisconnected() {
        Log.w(TAG, "onBillingServiceDisconnected")
    }

...

}

Is this an issue with Samsung devices? Why do I receive multiple calls to onBillingSetupFinished when I call startConnection just once?

Valero answered 1/11, 2020 at 11:43 Comment(5)
I'm seeing a lot of users in Asia (Singapore, Malaysia, Thailand, actually Australia too) get this error even when Google Play is up to date and they have a valid payment set up. Haven't been able to solve it. :(Discontinue
I am stuck too. Running on One Plus 7 with latest play store app. I am practically stuck now and no solution anywhere. This is the most frustrating part of android dev. None of their error messages mean anything.Cassidycassie
This happens on play store simulator API 32. play store version Version: 33.4.09-21 ... Looks like we are doomed.Calamite
Does this answer your question? "in-app billing version 3 NOT supported" with up to date Play StoreLinkman
any news on this issue?Avivah

© 2022 - 2024 — McMap. All rights reserved.