purchase failed for unknown reason in my last build

Hi, since my last build I saw some failed payment with Unknown reason on Android (Google Play Store)

Here is the log before the onPurchaseFailed:
onPurchaseFailedEvent(productId:xxxxxx message: {M: GPUL.HEC} - Response Code = 3)

Is there more information about this response code somewhere ?

I use the In App Purchasing package 4.5.2 in this build.

Hello ! @BBO_Lagoon , we do not currently cover this BillingClient.BillingResponseCode (3)

BILLING_UNAVAILABLE
Examples where this error may occur:

  • The Play Store app on the user’s device is out of date.
  • The user is in an unsupported country.
  • The user is an enterprise user and their enterprise admin has disabled users from making purchases.
  • Google Play is unable to charge the user’s payment method.

Letting the user retry may succeed if the condition causing the error has changed (e.g. An enterprise user’s admin has allowed purchases for the organization).
Constant Value: 3 (0x00000003)

Info from : BillingClient.BillingResponseCode  |  Android Developers

Hi,
Thanks for your answer.
So is BILLING_UNAVAILABLE the same as PurchaseFailureReason.PurchasingUnavailable ?

Hello,
No problem.
They are 2 different things : BILLING_UNAVAILABLE is an error code sent by google.
PurchaseFailureReason.PurchasingUnavailable is an error in the IAP SDK that can be caused by things like:

  • BILLING_UNAVAILABLE or any non-ok (success**)** code sent by google while handling google billing purchase flow.
  • InitiatePurchase(string productID) being called with a null IStoreController in CodelessIAPStoreListener.

In brief, BILLING_UNAVAILABLE can cause a PurchaseFailureReason.PurchasingUnavailable.

OK, so why the reason in the OnPurchaseFailed is PurchaseFailureReason.Unknown and not PurchaseFailureReason.PurchasingUnavailable ?
.

iIt could be more then on thing. :

  • In our implementation of com.android.billingclient.api.PurchasesUpdatedListener#onPurchasesUpdated if the result sent by google is a result with a responseCode OK (success) but with an empty list of purchases, we internally handle it as en error. and give the PurchaseFailureReason.Unknown since it is our catchall FailureReason.

  • When we receive a success result from google, but the Purchase.PurchaseState is not PENDING or PURCHASED we handle it as an error and give the PurchaseFailureReason.Unknown. Here’s the google doc on the subject.

  • They are some other error edge cases that we internally handle with the PurchaseFailureReason.Unknown Like your situation.

In your case, with the code M: GPUL.HEC I can tell you that you are getting this FailureReason because the code received was BILLING_UNAVAILABLE and it falls in our “catchall” FailureReason in our implementation of onPurchasesUpdated but we still output the google result responseCode for debugging / testing purposes.

In other features implementation google’s BILLING_UNAVAILABLE can result in our sdk’s PurchaseFailureReason.PurchasingUnavailable, like i in the exemples i mentioned early in the thread.

OK thanks for the clarifications.

I’m having the same problem, but none of these descriptions for Billing Unavailable make sense to me, I’ve tested on different devices with different accounts and I’m still having the same problem, I’m refusing to believe that this isn’t an incompatibility between Unity vs Google .

9370253--1310573--Captura_de_tela_2023-09-26_143109.png
9370253--1310576--IMG-20230927-WA0000.jpg

Hi noclipstudio,

Are you trying to make a test purchase? Or do you face this problem also on production?

I faced the problem in production, I asked a colleague to test the purchase on his device and the same error occurred.

1 Like

Thanks @noclipstudio It’s the same for us. Not working on both production and test setup.

Did you have a warning and a deadline from Google Play to release a new version with target API 33?

Let me know if you find a solution, I’ll do the same. Regarding Google’s warning, I’m not sure if it’s related to Billing, but my problem regarding the version was resolved after Unity released the update for Unity IAP, so I was able to change the SDK target to 34 again.

1 Like