Skip to main content
Samsung Developer Program

OpenIABEventManager : MonoBehavior

OpenIAB class for managing in-app item related functions

public class OpenIABEventManager : MonoBehavior

This class is the manager of events such as billing, querying items, purchasing items, consuming items, and restoring items.

Callback Summary

Modifier and Type

Callback

public static event Action

billingSupportedEvent

public static event Action<string>

billingNotSupportedEvent

public static event Action<Inventory>

queryInventorySucceededEvent

public static event Action<string>

queryInventoryFailedEvent

public static event Action<Purchase>

purchaseSucceededEvent

public static event Action<int, string>

purchaseFailedEvent

public static event Action<Purchase>

consumePurchaseSucceededEvent

public static event Action<string>

consumePurchaseFailedEvent

public static event Action<string>

transactionRestoredEvent

public static event Action<string>

restoreFailedEvent

public static event Action

restoreSucceededEvent

Callback Details

billingSupportedEvent 

public static event Action billingSupportedEvent

Successful init callback; billing is supported on the current platform.

This event is fired when the billing is supported.

billingNotSupportedEvent 

public static event Action<string> billingNotSupportedEvent

Failed init callback; billing is NOT supported on current platform.        

This event is fired when the billing is not supported.

queryInventorySucceededEvent 

public static event Action<Inventory> queryInventorySucceededEvent

Successful QueryInventory callback. This event is fired when the query inventory succeeded.

Returns:

Purchase history and app store listings are returned.

queryInventoryFailedEvent 

public static event Action<string> queryInventoryFailedEvent

Failed QueryInventory callback.

This event is fired when the query inventory failed.                                                      

purchaseSucceededEvent 

public static event Action<Purchase> purchaseSucceededEvent

Successful purchase callback.

This event is fired when the purchase of a product or subscription succeeded.                 

purchaseFailedEvent 

public static event Action<int, string> purchaseFailedEvent

Failed purchase callback

This event is fired when the purchase of a product or subscription failed.    

consumePurchaseSucceededEvent 

public static event Action<Purchase> consumePurchaseSucceededEvent

Successful consume attempt callback

This event is fired after the purchase product is consumed or is used.

consumePurchaseFailedEvent 

public static event Action<string> consumePurchaseFailedEvent

Failed consume attempt callback

This event is fired after the purchase product is failed to be consumed or is used.

transactionRestoredEvent 

public static event Action<string> transactionRestoredEvent

Successful transaction restoration callback. This event is fired when a transaction is restored.

NOTE: This API method is supported by OpenIAB but currently is NOT supported by Android™ OS.

restoreFailedEvent 

public static event Action<string> restoreFailedEvent

Failed transaction restoration callback.

This event is fired when a transaction restoration process failed.

restoreSucceededEvent 

public static event Action  restoreSucceededEvent

Successful transaction restoration callback.

This event is fired when a transaction restoration process succeeded.

Method Summary

Modifier and Type

Method

private void

Awake()

private void

OnMapSkuFailed(string exception)

private void

OnBillingSupported(string empty)

private void

OnBillingNotSupported(string error)

private void

OnQueryInventorySucceeded(string json)

private void

OnQueryInventoryFailed(string error)

private void

OnPurchaseSucceeded(string json)

private void

OnPurchaseFailed(string message)

private void

OnConsumePurchaseSucceeded(string json)

private void

OnConsumePurchaseFailed(string error)

public void

OnTransactionRestored(string sku)

public void

OnRestoreTransactionFailed(string error)

public void

OnRestoreTransactionSucceeded(string message)

Method Details

Awake

private void Awake()

Sets the GameObject name to the class name for easy access via a native plugin.

Awake is part of the MonoBehavior in Unity. It is called when the script instance is being loaded.

OnMapSkuFailed

private void  OnMapSkuFailed(string exception)

Function for failed mapping of SKUs. Logs the exception received.

The SKU is attempting to be mapped to the app store. The exception message is from OpenIAB; it is specified in the library.

Parameters:

exception

Exception message to be included in the callback

OnBillingSupported

private void OnBillingSupported(string empty)

Function to be called when billing is supported. Fires the callback billingSupportedEvent.

Parameters:

empty

Empty string

OnBillingNotSupported

private void OnBillingNotSupported(string error)

Function to be called when billing is unsupported. Fires the callback billingNotSupportedEvent.

Parameters:

error

Error message

OnQueryInventorySucceeded

private void OnQueryInventorySucceeded(string json)

Function to be called for successful queries of inventories. Fires the callback queryInventorySucceededEvent.

Parameters:

json

String in JSON format
OnQueryInventoryFailed

private void OnQueryInventoryFailed(string error)

Function to be called for failed queries of inventories. Fires the callback queryInventoryFailedEvent.

Parameters:

error

Error message

OnPurchaseSucceeded

private void OnPurchaseSucceeded(string json)

Function to be called for successful purchases. Fires the callback purchaseSucceededEvent.

Parameters:

json String in JSON format
 
OnPurchaseFailed

private void OnPurchaseFailed(string message)

Function to be called for failed purchases. Fires the callback purchaseFailedEvent.

Parameters:

message Message string
OnConsumePurchaseSucceeded

private void OnConsumePurchaseSucceeded(string json)

Function to be called for successful consumption of purchase items. Fires the callback consumePurchaseSucceededEvent.

Parameters:

json String in JSON format
OnConsumePurchaseFailed

private void OnConsumePurchaseFailed(string error)

Function to be called for failed consumption of purchase items. Fires the callback consumePurchaseFailedEvent.

Parameters:

error Error message
OnTransactionRestored

private void OnTransactionRestored(string sku)

Function to be called for transaction restoration of the specified item SKU. Fires the callback transactionRestoredEvent.

Parameters:

sku SKU identifier of the item
OnRestoreTransactionFailed

private void OnRestoreTransactionFailed(string error)

Function to be called for failed transaction restorations. Fires the callback restoreFailedEvent.

Parameters:

error Error message
OnRestoreTransactionSucceeded 

private void OnRestoreTransactionSucceeded(string message)

Function to be called for successful transaction restoration. Fires the callback restoreSucceededEvent.

Parameters:

message Message string
  • Was this article helpful?