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

Question unity IAP no OnPurchaseFailed callback

Discussion in 'Unity IAP' started by ryan_unity157, May 10, 2023.

  1. ryan_unity157

    ryan_unity157

    Joined:
    Aug 20, 2018
    Posts:
    2
    HI,I need help
    I am using Unity 2020.3.35f1 with IAP version 4.7.0 in a game in Thailand.
    When using Google payments with promptpay as the payment method, I obtained a payment code. However, when I cancelled the purchase, I did not receive an OnPurchaseFailed callback.
    It should be said that I will receive OnPurchaseFailed when I leave the google Play payment page before I get the payment code, and the whole process is normal. And my normal purchase can also be successful, only after I choose to get the payment code and leave the google play payment page will I not receive it.
     
  2. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    217
    Hello,
    Based on Google Play Help, the QR code remains in the purchase history once it's generated. This means a pending purchase was created which is why there's no OnPurchaseFailed callback, since it can be paid for at a later time.
     
  3. ryan_unity157

    ryan_unity157

    Joined:
    Aug 20, 2018
    Posts:
    2
    Hi,
    Can I only use OnApplicationFocus to know that he has returned to the APP? Or is there another callback that can be used?
    Thanks for answering.
     
  4. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    217
    Yes, that should work.

    There's also OnApplicationPause that could do what you're looking for.