Class CodelessIAPStoreListener
Initializes Unity IAP with the Products defined in the default IAP ProductCatalog.
Automatically initializes at runtime load when enabled in the GUI. enableCodelessAutoInitialization
Manages CodelessIAPButtons and IAPListeners.
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("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
protected IStoreController controller
Field Value
| Type | Description |
|---|---|
| IStoreController |
See Also
extensions
For advanced scripted store-specific IAP actions, use this session's IExtensionProvider after initialization.
Declaration
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
protected IExtensionProvider extensions
Field Value
| Type | Description |
|---|---|
| IExtensionProvider |
See Also
initializationComplete
Allows outside sources to know whether the successful initialization has completed.
Declaration
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", 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 |
|---|---|
| CodelessIAPStoreListener |
StoreController
For advanced scripted IAP actions, use this session's IStoreController after
initialization.
Declaration
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
public IStoreController StoreController { get; }
Property Value
| Type | Description |
|---|---|
| IStoreController |
See Also
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 |
|---|---|---|
| CodelessIAPButton | button | CodelessIAPButton to register. |
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 |
|---|---|
| ProductCatalog | The |
GetStoreConfiguration<T>()
For advanced scripted store-specific IAP actions, use this session's IStoreConfigurations.
Note, these instances are only available after initialization through Codeless IAP, currently.
Declaration
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
public T GetStoreConfiguration<T>() where T : IStoreConfiguration
Returns
| Type | Description |
|---|---|
| T | Returns the store configuration. |
Type Parameters
| Name | Description |
|---|---|
| T | A subclass of |
GetStoreExtensions<T>()
For advanced scripted store-specific IAP actions, use this session's IStoreExtensions after initialization.
Declaration
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
public T GetStoreExtensions<T>() where T : IStoreExtension
Returns
| Type | Description |
|---|---|
| T | Returns the store extension. |
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
| Type | Description |
|---|---|
| bool | Whether this identifier exists in m_Catalog |
See Also
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 | True if the initialization has completed successfully, false otherwise. |
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 |
|---|---|---|
| CodelessIAPButton | button | CodelessIAPButton to unregister. |
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 |