Class CodelessIAPStoreListener
Initializes Unity IAP with the Product
s defined in the default IAP ProductCodelessIAPButton
s and IAPListener
s.
Inherited Members
Namespace: UnityEngine .Purchasing
Assembly: Unity.Purchasing.Codeless.dll
Syntax
public class CodelessIAPStoreListener
Fields
controller
For advanced scripted IAP actions, use this session's IStoreController
after initialization.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
protected IStoreController controller
Field Value
Type | Description |
---|---|
IStore |
extensions
For advanced scripted store-specific IAP actions, use this session's IExtensionProvider
after initialization.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
protected IExtensionProvider extensions
Field Value
Type | Description |
---|---|
IExtension |
initializationComplete
Allows outside sources to know whether the successful initialization has completed.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
public static bool initializationComplete
Field Value
Type | Description |
---|---|
bool |
Properties
Instance
Singleton of me. Initialized on first access.
Also initialized by RuntimeInitializeOnLoadMethod if ProductCatalog.enableCodelessAutoInitialization.enableCodelessAutoInitialization
is true.
Declaration
public static CodelessIAPStoreListener Instance { get; }
Property Value
Type | Description |
---|---|
Codeless |
StoreController
For advanced scripted IAP actions, use this session's IStoreController
after
initialization.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
public IStoreController StoreController { get; }
Property Value
Type | Description |
---|---|
IStore |
Methods
AddButton(CodelessIAPButton)
Register an CodelessIAPButton
to send IAP initialization and purchasing events.
Use to making IAP functionality visible to the user.
Declaration
public void AddButton(CodelessIAPButton button)
Parameters
Type | Name | Description |
---|---|---|
Codeless |
button |
AddListener(IAPListener)
Register an IAPListener
to send IAP purchasing events.
Declaration
public void AddListener(IAPListener listener)
Parameters
Type | Name | Description |
---|---|---|
IAPListener | listener | Listener to receive IAP purchasing events |
GetProduct(string?)
Access a Product
for this app.
Declaration
public Product? GetProduct(string? productID)
Parameters
Type | Name | Description |
---|---|---|
string | productID | A product identifier to find as a |
Returns
Type | Description |
---|---|
Product | A |
GetProductCatalog()
Returns the ProductCatalog
loaded from the project's IAP Catalog.
Declaration
public ProductCatalog GetProductCatalog()
Returns
Type | Description |
---|---|
Product |
GetStoreConfiguration<T>()
For advanced scripted store-specific IAP actions, use this session's IStoreConfiguration
s.
Note, these instances are only available after initialization through Codeless IAP, currently.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
public T GetStoreConfiguration<T>() where T : IStoreConfiguration
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | A subclass of |
GetStoreExtensions<T>()
For advanced scripted store-specific IAP actions, use this session's IStoreExtension
s after initialization.
Declaration
[Obsolete("Please upgrade to the new APIs available. For more info visit `Upgrading to IAP v5` in the IAP documentation. https://docs.unity3d.com/Packages/com.unity.purchasing@latest", false)]
public T GetStoreExtensions<T>() where T : IStoreExtension
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | A subclass of |
HasProductInCatalog(string)
Inspect my ProductCatalog
for a product identifier.
Declaration
public bool HasProductInCatalog(string productID)
Parameters
Type | Name | Description |
---|---|---|
string | productID | Product identifier to look for in m_Catalog. Note this is not the store-specific identifier. |
Returns
InitiatePurchase(string?)
Purchase a product by its identifier.
Sends purchase failure event with PurchaseFailureReason.PurchasingUnavailable.PurchasingUnavailable
to all registered CodelessIAPButtons if not yet successfully initialized.
Declaration
public void InitiatePurchase(string? productID)
Parameters
Type | Name | Description |
---|---|---|
string | productID | Product identifier of |
IsInitialized()
Allows outside sources to know whether the successful initialization has completed.
Declaration
public bool IsInitialized()
Returns
Type | Description |
---|---|
bool |
RemoveButton(CodelessIAPButton)
Stop sending initialization and purchasing events to an CodelessIAPButton
. Use when disabling
the button, e.g. when closing a scene containing that button and wanting to prevent the user from making any
IAP events for its product.
Declaration
public void RemoveButton(CodelessIAPButton button)
Parameters
Type | Name | Description |
---|---|---|
Codeless |
button |
RemoveListener(IAPListener)
Unregister an IAPListener
from IAP purchasing events.
Declaration
public void RemoveListener(IAPListener listener)
Parameters
Type | Name | Description |
---|---|---|
IAPListener | listener | Listener to no longer receive IAP purchasing events |