docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IProductService

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

    Namespace: UnityEngine.Purchasing
    Assembly: Unity.Purchasing.dll
    Syntax
    public interface IProductService

    Properties

    Apple

    Apple Specific Product Extensions

    Declaration
    IAppleStoreExtendedProductService? Apple { get; }
    Property Value
    Type Description
    IAppleStoreExtendedProductService

    Methods

    FetchProducts(List<ProductDefinition>, IRetryPolicy?)

    Fetches products matching the set of definitions passed as input. Be sure to first register your callbacks via OnProductsFetched and OnProductsFetchFailed.

    Declaration
    void FetchProducts(List<ProductDefinition> productDefinitions, IRetryPolicy? retryPolicy = null)
    Parameters
    Type Name Description
    List<ProductDefinition> productDefinitions

    The definitions of the products to be fetched.

    IRetryPolicy retryPolicy

    A custom retry policy that can be used for the fetch products query. If unspecified, an exponential backoff retry policy will be used.

    FetchProductsWithNoRetries(List<ProductDefinition>)

    Fetches products matching the set of definitions passed as input. Be sure to first register callbacks via AddProductsUpdatedAction and AddProductsFetchFailedAction.

    Declaration
    void FetchProductsWithNoRetries(List<ProductDefinition> productDefinitions)
    Parameters
    Type Name Description
    List<ProductDefinition> productDefinitions

    The definitions of the products to be fetched.

    GetProductById(string)

    Gets a product by its product ID. If no product is found with the specified product ID, attempts to locate a product with a matching store-specific product ID. Returns null if no matching product is found.

    Declaration
    Product? GetProductById(string productId)
    Parameters
    Type Name Description
    string productId

    The ID of the product.

    Returns
    Type Description
    Product

    The matching product if found, otherwise returns null.

    GetProducts()

    Gets the collection of all products that have been fetched successfully.

    Declaration
    ReadOnlyObservableCollection<Product> GetProducts()
    Returns
    Type Description
    ReadOnlyObservableCollection<Product>

    An observable collection of the products already fetched.

    Events

    OnProductsFetchFailed

    Callback invoked when an attempt to fetch products has failed or when a subset of products failed to be fetched.

    Declaration
    event Action<ProductFetchFailed>? OnProductsFetchFailed
    Event Type
    Type Description
    Action<ProductFetchFailed>

    OnProductsFetched

    Callback invoked with products that are successfully fetched.

    Declaration
    event Action<List<Product>>? OnProductsFetched
    Event Type
    Type Description
    Action<List<Product>>
    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)