docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class UnityIAPServices

    Unity IAP Services Entry Point

    Inheritance
    object
    UnityIAPServices
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Purchasing
    Assembly: Unity.Purchasing.dll
    Syntax
    public static class UnityIAPServices

    Methods

    AddNewCustomStore(IStoreWrapper)

    Add a new custom store which can then be referenced by name to get its services. This will register the store with IAP. If no custom services are added via the other functions, a generic StoreService, ProductService and PurchaseService will be created to drive the custom store with no extended features.

    Declaration
    public static void AddNewCustomStore(IStoreWrapper customStoreWrapper)
    Parameters
    Type Name Description
    IStoreWrapper customStoreWrapper

    The implementation of the store wrapper for the custom store,

    AddNewExtendedProductService(string, Func<IProductService, ExtensibleProductService>)

    Add a function for a new custom Product Service, the result of which will be retained and maintained by the API. This function assumes that the interface of IProductService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensibleProductService.

    Declaration
    public static void AddNewExtendedProductService(string storeName, Func<IProductService, ExtensibleProductService> createProductService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IProductService, ExtensibleProductService> createProductService

    A function to return an instance of the custom ExtensibleProductService. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    AddNewExtendedPurchaseService(string, Func<IPurchaseService, ExtensiblePurchaseService>)

    Add a function for a new custom Purchase Service, the result of which will be retained and maintained by the API. This function assumes that the interface of IPurchaseService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensiblePurchaseService.

    Declaration
    public static void AddNewExtendedPurchaseService(string storeName, Func<IPurchaseService, ExtensiblePurchaseService> createPurchaseService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IPurchaseService, ExtensiblePurchaseService> createPurchaseService

    A function to return an instance of the custom ExtensiblePurchaseService. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    AddNewExtendedStoreService(string, Func<IStoreService, ExtensibleStoreService>)

    Add a function for a new custom StoreService, the result of which will be retained and maintained by the API. This function assumes that the interface of IStoreService will be the SDK's generic once and that extension and configuration implementations will be added to the derived version of ExtensibleStoreService.

    Declaration
    public static void AddNewExtendedStoreService(string storeName, Func<IStoreService, ExtensibleStoreService> createStoreService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IStoreService, ExtensibleStoreService> createStoreService

    A function to return an instance of the custom ExtensibleStoreService. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    AddNewProductService(string, Func<IProductService>)

    Add a function for a new custom Product Service, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IProductService has been implemented from scratch.

    Declaration
    public static void AddNewProductService(string storeName, Func<IProductService> createProductService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IProductService> createProductService

    A function to return an instance of the Product Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    AddNewPurchaseService(string, Func<IPurchaseService>)

    Add a function for a new custom Purchase Service, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IPurchaseService has been implemented from scratch.

    Declaration
    public static void AddNewPurchaseService(string storeName, Func<IPurchaseService> createPurchaseService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IPurchaseService> createPurchaseService

    A function to return an instance of the Purchase Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    AddNewStoreService(string, Func<IStoreService>)

    Add a function for a new custom StoreService, the result of which will be retained and maintained by the API. This function assumes that all of the interface of IStoreService has been implemented from scratch.

    Declaration
    public static void AddNewStoreService(string storeName, Func<IStoreService> createStoreService)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which the custom service is mapped.

    Func<IStoreService> createStoreService

    A function to return an instance of the Store Service. Normally this will be called only once upon first reference and calling Store(storeName) will always return the same instance.

    DefaultProduct()

    A service responsible for fetching and storing products available for purchase from the default store.

    Declaration
    public static IProductService DefaultProduct()
    Returns
    Type Description
    IProductService

    The default IProductService implementation for the current default platform.

    DefaultPurchase()

    A service responsible for ordering products, fetching previous purchases from the default store and validating product entitlements.

    Declaration
    public static IPurchaseService DefaultPurchase()
    Returns
    Type Description
    IPurchaseService

    The default IPurchaseService implementation for the current default platform.

    DefaultStore()

    A service responsible for connecting to the default store and its extensions.

    Declaration
    public static IStoreService DefaultStore()
    Returns
    Type Description
    IStoreService

    The default IStoreService implementation for the current default platform.

    Product(string)

    A service responsible for fetching and storing products available for purchase.

    Declaration
    public static IProductService Product(string storeName)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which to get the service.

    Returns
    Type Description
    IProductService

    The IProductService implementation for the specified store.

    Purchase(string)

    A service responsible for ordering products, fetching previous purchases from the store indicated and validating product entitlements.

    Declaration
    public static IPurchaseService Purchase(string storeName)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which to get the service.

    Returns
    Type Description
    IPurchaseService

    The IPurchaseService implementation for the specified store.

    SetStoreAsDefault(string)

    Sets a different store as the default. Useful for using custom stores.

    Declaration
    public static void SetStoreAsDefault(string storeName)
    Parameters
    Type Name Description
    string storeName

    The name of the store and therefore services to be referenced by default by internal and external calls.

    Store(string)

    A service responsible for connecting to a store and its extensions.

    Declaration
    public static IStoreService Store(string storeName)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which to get the service.

    Returns
    Type Description
    IStoreService

    The IStoreService implementation for the specified store.

    StoreController(string?)

    Used by Applications to control Unity In-App Purchasing. This is a wrapper over the services meant to be used a single point of entry for the application.

    Declaration
    public static StoreController StoreController(string? storeName = null)
    Parameters
    Type Name Description
    string storeName

    The name of the store for which to get the store controller. When null, the default store will be used.

    Returns
    Type Description
    StoreController

    A new StoreController instance for the specified store, or the default store if storeName is null.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)