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 PurchaseFailureReason vs PurchaseFailureDescription

Discussion in 'Unity IAP' started by tomlugin100, Jul 13, 2023.

  1. tomlugin100

    tomlugin100

    Joined:
    May 6, 2023
    Posts:
    51
    Hello everyone and thank you so much for reading my post!
    I'm trying to implement the PurchaseFailureReason for my in-app purchase. However, in the Inspector the function to implement is called PurchaseFailureDescription. I have the latest IAP-package. I have
    using UnityEngine.Purchasing
    at the top of my code. Even after I implement PurchaseFailureReason as such:
    Code (CSharp):
    1. public void purchaseFailed(Product product, PurchaseFailureReason p)
    2.     {
    3.         purchaseFailedText.SetActive(true);
    4.     }
    the function doesn't show up in the inspector, and I believe its because PurchaseFailureReason doesn't match PurchaseFailureDescription in the inspector. As you can see in the screenshot I've attached, in the Inspector the function which is triggered by a failed purchase takes the parameters Product and PurchaseFailureDesription. But in the Unity docs this doesn't even exist - what exists is PurchaseFailureReason. What can I do to solve this issue?
     

    Attached Files:

    Last edited: Jul 13, 2023
  2. tomlugin100

    tomlugin100

    Joined:
    May 6, 2023
    Posts:
    51
    Nevermind, I've solved my problem. I needed to add
    using UnityEngine.Purchasing.Extension;
    to the top of my code
     
    justindpnt likes this.