Search Unity

Get OnPurchaseFailed and ProcessPurchase when minimizing app during transaction

Discussion in 'Unity IAP' started by matthew-holtzem, Dec 2, 2020.

  1. matthew-holtzem

    matthew-holtzem

    Joined:
    Sep 1, 2016
    Posts:
    40
    This is happening to me on Android using Unity IAP version 2.0.6

    Flow goes like this
    • Initiate Purchase
    • Click "1 Tap Buy"
      Minimize app while "processing" but don't kill it
    • wait a second or two and re-open/re-focus app
    • Unity IAP calls OnPurchaseFailed with reason Unknown
    • Unity IAP calls ProcessPurchase

    I'm guessing this is not by design and is some kind of bug?
     
    Last edited: Dec 2, 2020
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Correct, this should not happen. We will look into it, thanks for the heads up.
     
  3. matthew-holtzem

    matthew-holtzem

    Joined:
    Sep 1, 2016
    Posts:
    40
    Realized I never actually wrote down the version we are on. Just updated my original post with the Unity Purchasing Package version
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It's a bit confusing, but that is the Package Manager version. We generally go by the Asset version. In the Unity editor, go to menu Window/Unity IAP/IAP Updates... and it will show the version.
     
    matthew-holtzem likes this.
  5. matthew-holtzem

    matthew-holtzem

    Joined:
    Sep 1, 2016
    Posts:
    40
    Also this might be related but if I do the same flow but kill the app instead of minimizing it ProcessPurchase gets called twice after the IAP System initializes
     
  6. matthew-holtzem

    matthew-holtzem

    Joined:
    Sep 1, 2016
    Posts:
    40
    Ok installed version is 2.0.0
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please try with IAP 2.2.3
     
    matthew-holtzem likes this.
  8. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
  9. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    233
    Hello chrismarch,

    Without knowing the full details, it's hard to tell, but I believe this might have been caused by a deferred purchase which was getting processed when purchases were being fetched.

    This is something that had to be handled in ProcessPurchase prior to IAP 4.6.0, but since that version, this is handled by IAP directly.