0

I am trying to acknowledge my purchases on android but I am getting response code 3 every time with the message 'Google Play In-app Billing API version is less than 9'. The purchases are arriving at this functioning with all of the details required, token, etc. But still, it's not working.

I am using the latest version of the IAB library in my app:

private fun acknowledgeNonConsumablePurchasesAsync(nonConsumables: List<Purchase>) {
        nonConsumables.forEach { purchase ->
            val params = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(purchase
                .purchaseToken).build()
            playStoreBillingClient.acknowledgePurchase(params) { billingResult ->
                when (billingResult.responseCode) {
                    BillingClient.BillingResponseCode.OK -> {
                        disburseNonConsumableEntitlement(purchase)
                    }
                    else -> Log.d(LOG_TAG, "acknowledgeNonConsumablePurchasesAsync response is ${billingResult.debugMessage}")
                }
            }

        }
    }
paul_f
  • 1,296
  • 17
  • 20
  • A response-code of 3 refers to BILLING_UNAVAILABLE which is documented as "Billing API version is not supported for the type requested ". Are you testing it in a device with the Google Play Services and Play Store installed? In addition, are you using the latest billing library? "com.android.billingclient:billing:2.0.2" – PerracoLabs Jul 17 '19 at 13:17
  • Hi Perraco, This is to do with acknowledging a purchase. The error debug message is as mentioned above. – paul_f Jul 17 '19 at 13:19
  • 1
    Check if the playStoreBillingClient instance is still valid (opened) when calling acknowledgePurchase, and while it is being executed, since acknowledging a purchase is asynchronous and the billing client must remain active while processing it. Although, what's confusing is the debug message stating that API version is less than 9. Are you using the official billing library or a custom AIDL wrapper? – PerracoLabs Jul 17 '19 at 13:26
  • This question may be related to the debug message, though is for a different code: https://stackoverflow.com/questions/56479824/google-play-in-app-billing-api-version-is-less-than-3 – PerracoLabs Jul 17 '19 at 13:30
  • I am using the official with the very latest release: com.android.billingclient:billing:2.0.2 – paul_f Jul 17 '19 at 13:39
  • 1
    Check if there was a problem with the Google Play Store cache. Try to clean it through the device installed apps, just to discard that is not a problem with the store. – PerracoLabs Jul 17 '19 at 13:45
  • Brilliant!!! Thank you so much. Please submit it as an answer and I will accept! – paul_f Jul 17 '19 at 13:56

1 Answers1

1

Check if there was a problem with the Google Play Store cache.

Try to clean it through the device installed apps, just to discard that is not a problem with the store.

If you find is a problem with the Google Play Store cache, and the problem happens again, then I would recommend that you file a bug in the Issue Tracker

PerracoLabs
  • 16,449
  • 15
  • 74
  • 127