docs.unity3d.com
    Show / Hide Table of Contents

    Class IAPListener

    An invisible GUI component for initializing Unity IAP and processing lifecycle events.

    Inheritance
    Object
    IAPListener
    Namespace: UnityEngine.Purchasing
    Syntax
    public class IAPListener : MonoBehaviour

    Fields

    consumePurchase

    Consume successful purchases immediately.

    Declaration
    public bool consumePurchase
    Field Value
    Type Description
    Boolean

    dontDestroyOnLoad

    Preserve this GameObject when a new scene is loaded.

    Declaration
    public bool dontDestroyOnLoad
    Field Value
    Type Description
    Boolean

    onPurchaseComplete

    Event fired after a successful purchase of this product.

    Declaration
    public IAPListener.OnPurchaseCompletedEvent onPurchaseComplete
    Field Value
    Type Description
    IAPListener.OnPurchaseCompletedEvent

    onPurchaseFailed

    Event fired after a failed purchase of this product.

    Declaration
    public IAPListener.OnPurchaseFailedEvent onPurchaseFailed
    Field Value
    Type Description
    IAPListener.OnPurchaseFailedEvent

    Methods

    OnPurchaseFailed(Product, PurchaseFailureReason)

    Invoked on a failed purchase of the product associated with this button

    Declaration
    public void OnPurchaseFailed(Product product, PurchaseFailureReason reason)
    Parameters
    Type Name Description
    Product product

    The Product which failed to purchase

    PurchaseFailureReason reason

    Information to help developers recover from this failure

    ProcessPurchase(PurchaseEventArgs)

    Invoked to process a successful purchase of the product associated with this button

    Declaration
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    Parameters
    Type Name Description
    PurchaseEventArgs e

    The successful PurchaseEventArgs for the purchase event.

    Returns
    Type Description
    PurchaseProcessingResult

    The result of the successful purchase

    See Also

    CodelessIAPStoreListener
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023