Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity_IAP_2.2.4 and Core Package 2.2.1 Play Store Errors

Discussion in 'Unity IAP' started by ex-nihilio, Dec 7, 2020.

  1. ex-nihilio

    ex-nihilio

    Joined:
    Jan 23, 2015
    Posts:
    12
    On Play Store
    --- PurchaseCanceled and PurchaseError messages are always empty or null ----
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'm not seeing this. I just tried to purchase a product not yet defined on the store, and I got a valid failureReason in the OnPurchaseFailed callback as expected saying "Not purchasing product, either is not found or is not available for purchase." I'm testing the same version as you mention with the Sample IAP Project here https://forum.unity.com/threads/sample-iap-project.529555/ . I also tested cancel and receive "UserCancelled". Can you provide more information?
     
  3. ex-nihilio

    ex-nihilio

    Joined:
    Jan 23, 2015
    Posts:
    12
    When the purchase is failed on Play Store,

    m_TransactionHistoryExtensions.GetLastPurchaseFailureDescription() = null or
    m_TransactionHistoryExtensions.GetLastPurchaseFailureDescription().message is empty/null

    in the function -> public void OnPurchaseFailed(Product item, PurchaseFailureReason r)
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I'm checking PurchaseFailureReason r only, is there a reason you are calling the API additionally? Was this working in a previous IAP version for you?
     
    ex-nihilio likes this.
  5. ex-nihilio

    ex-nihilio

    Joined:
    Jan 23, 2015
    Posts:
    12
    -> Yes it was working in Unity_IAP_2.1.1

    -> There is no specific reason to use the API.
     
  6. MatthieuSmith_Unity3D

    MatthieuSmith_Unity3D

    Unity Technologies

    Joined:
    Oct 16, 2020
    Posts:
    23
    Hello @ex-nihilio

    Indeed this is no longer used in the new implementation of Google. That being said maybe your use case was not covered with our changes. Would you kindly explain the use case you have to call these extensions method instead of using the callbacks you receive from OnPurchaseFailed?

    It might be something we over looked when shipping Google Billing v3 or there might be a change that wasn't clearly described.

    Please let us know what you are trying to do and we will work towards making it possible.

    ====
    Here is a more detailed explanation of why it is no longer a thing.

    Before IAP 2.2.0, we were using Google AIDL which will be deprecated and removed in 2021 by Google.

    Starting from IAP 2.2.0 we switch over to Google Billing v3. This switch was MASSIVE and some features are combined now on Googles side, so we followed suit.

    On a more technical note here but before the Google AIDL version was purely java and had to convert ever call to JSON to talk to our C# layer. Now it's full C# so no more converting back and forth between layers. In this JSON converter was where we stored a local variable to handle the method `GetLastPurchaseFailureDescription`.
     
  7. ex-nihilio

    ex-nihilio

    Joined:
    Jan 23, 2015
    Posts:
    12
    I have a crash report from Google Play as below,

    java.lang.NullPointerException
    -> com.unity.purchasing.googleplay.FailedPurchaseReconciler.addFailureDescription

    Stack trace
    TCT (Alcatel) 8063Android 6.0 (SDK 23)

    Type
    java.lang.Error
    java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2020.1.13f1
    Device model : TCL 8063
    Device fingerprint: *****:user/release-keys
    Build Type : Release
    Scripting Backend : IL2CPP
    ABI : armeabi-v7a
    Strip Engine Code : true

    Caused by
    at android.app.LoadedApk$ReceiverDispatcher$Args.run (LoadedApk.java:932)
    at android.os.Handler.handleCallback (Handler.java:815)
    at android.os.Handler.dispatchMessage (Handler.java:104)
    at android.os.Looper.loop (Looper.java:207)
    at android.app.ActivityThread.main (ActivityThread.java:5728)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:888)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:749)
    Caused by: java.lang.NullPointerException:
    at com.unity.purchasing.googleplay.FailedPurchaseReconciler.addFailureDescription (FailedPurchaseReconciler.java:207)
    at com.unity.purchasing.googleplay.FailedPurchaseReconciler.retryReconcileAsync (FailedPurchaseReconciler.java:124)
    at com.unity.purchasing.googleplay.GooglePlayPurchasing.pollForNewPurchases (GooglePlayPurchasing.java:859)
    at com.unity.purchasing.googleplay.GooglePlayPurchasing.access$1200 (GooglePlayPurchasing.java:31)
    at com.unity.purchasing.googleplay.GooglePlayPurchasing$4.onReceive (GooglePlayPurchasing.java:870)
    at android.app.LoadedApk$ReceiverDispatcher$Args.run (LoadedApk.java:922)
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    We would need additional information and steps to reproduce.