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.

Bug Android Cancel Purchase Exception

Discussion in 'Unity IAP' started by Arkuni, May 6, 2022.

  1. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    41
    I get an error when I try to cancel an in-app purchase on Android while the pop-up is loading. I get the error as shown here.

    unknown.png

    A few details.
    • We are running the latest version of 2021 LTS.
      We are using 4.1.4 IAP
    • It works as expected on iPhone.
    • It works as expected when completing the purchase on Android.
    • It works as expected when waiting for the pop-up to load.
    • I am getting the same error on both a new and quite old android phone.
    • It happens on previously working IAP products.
    Any idea what we can do?
     
    Last edited: May 6, 2022
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You have a null reference exception in your code. Have you determined what is null? You will want to debug your code to find out. What are these messages "Received a bad purchase data" and "Couldn't find single purchase data as well". Those are not API messages. It looks like the error is in your code. Please compare to the known working code in the Sample IAP Project v3 https://forum.unity.com/threads/sample-iap-project.529555/#post-7922275 and https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741
     
  3. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    41
    I am using Easy Mobile. The creator said that the exception is being thrown inside the Unity IAP class, which looks right from the stack trace. How can you tell that the problem is outside the Unity package when the top row says UnityEngine.Purchasing.GooglePurchaseUpdatedListener?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry about that, it looks like you are correct. I too see the same exception when I click on the app background when the purchase dialog is loading when using IAP 4.1.4. I will let engineering know right away.