Version: 5.5
public static void Initialize (Purchasing.IStoreListener listener, Purchasing.ConfigurationBuilder builder);

Parameters

listener Your Application's listener that processes purchasing related events.
builder Unity IAP configuration.

Description

Initialize Unity IAP with the specified listener and configuration.

Here is an example of initializing Unity IAP for a sample Store class.

using UnityEngine;
using UnityEngine.Purchasing;

public class MyStoreClass : MonoBehaviour, IStoreListener { void Awake() { ConfigurationBuilder builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance()); builder.AddProduct("levelpackfoo", ProductType.NonConsumable); UnityPurchasing.Initialize(this, builder); }

public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {} public void OnInitializeFailed(InitializationFailureReason error) {} public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) { return PurchaseProcessingResult.Complete; } public void OnPurchaseFailed(Product item, PurchaseFailureReason r) {} }