docs.unity3d.com
    Show / Hide Table of Contents

    Implementing a Store

    Your store must implement the IStore interface, the methods of which are detailed in following sections.

    using UnityEngine.Purchasing.Extension;
    
    public class MyStore : IStore
    {
        private IStoreCallback callback;
        public void Initialize (IStoreCallback callback)
        {
            this.callback = callback;   
        }
    
        public void RetrieveProducts (System.Collections.ObjectModel.ReadOnlyCollection<UnityEngine.Purchasing.ProductDefinition> products)
        {
            // Fetch product information and invoke callback.OnProductsRetrieved();
        }
    
        public void Purchase (UnityEngine.Purchasing.ProductDefinition product, string developerPayload)
        {
            // Start the purchase flow and call either callback.OnPurchaseSucceeded() or callback.OnPurchaseFailed()
        }
    
        public void FinishTransaction (UnityEngine.Purchasing.ProductDefinition product, string transactionId)
        {
            // Perform transaction related housekeeping 
        }
    }
    
    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