Class BillingServices
Inheritance
Inherited Members
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public static class BillingServices
Properties
ProductDefinitions
Declaration
public static BillingProductDefinition[] ProductDefinitions { get; }
Property Value
Type | Description |
---|---|
BillingProductDefinition[] |
Products
Declaration
public static IBillingProduct[] Products { get; }
Property Value
Type | Description |
---|---|
IBillingProduct[] |
UnitySettings
Declaration
public static BillingServicesUnitySettings UnitySettings { get; }
Property Value
Type | Description |
---|---|
BillingServicesUnitySettings |
Methods
BuyProduct(String, Int32, String)
Initiates purchase process for the specified billing product.
Declaration
public static bool BuyProduct(string productId, int quantity = 1, string applicationUsername = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | productId | The product you want to purchase. |
System.Int32 | quantity | The number of units you want to purchase. Default quantity value is 1. |
System.String | applicationUsername | Application provided username that initiated this request. (optional) |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
\note The payment request must have a product identifier registered with the Store.
BuyProduct(IBillingProduct, Int32, String)
Initiates purchase process for the specified billing product.
Declaration
public static bool BuyProduct(IBillingProduct product, int quantity = 1, string tag = null)
Parameters
Type | Name | Description |
---|---|---|
IBillingProduct | product | The product you want to purchase. |
System.Int32 | quantity | The number of units you want to purchase. Default quantity value is 1. |
System.String | tag | Specify user data associated with the purchase. Eg: Application provided username that initiated this request. (optional) |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
\note The payment request must have a product identifier registered with the Store.
CanMakePayments()
Determines whether the user is authorised to make payments.
Declaration
public static bool CanMakePayments()
Returns
Type | Description |
---|---|
System.Boolean |
|
ClearPurchaseHistory()
Clears the purchase history.
Declaration
public static void ClearPurchaseHistory()
FinishTransactions(IBillingTransaction[])
Completes the pending transactions and removes it from transaction queue.
Declaration
public static void FinishTransactions(IBillingTransaction[] transactions)
Parameters
Type | Name | Description |
---|---|---|
IBillingTransaction[] | transactions | An array of unfinished transactions. |
GetProductWithId(String)
Gets the billing product with localized information, which was previously fetched from the Store.
Declaration
public static IBillingProduct GetProductWithId(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | A string used to identify a billing product. |
Returns
Type | Description |
---|---|
IBillingProduct | The billing product fetched with localized information. |
GetProductWithTag(Object)
Gets the billing product with localized information, which was previously fetched from the Store.
Declaration
public static IBillingProduct GetProductWithTag(object tag)
Parameters
Type | Name | Description |
---|---|---|
System.Object | tag | A tag associated with billing product. |
Returns
Type | Description |
---|---|
IBillingProduct | The billing product fetched with localized information. |
GetTransactions()
Returns the pending transactions available in transaction queue.
Declaration
public static IBillingTransaction[] GetTransactions()
Returns
Type | Description |
---|---|
IBillingTransaction[] | An array of unfinished transactions. |
Remarks
\note User needs to manually call this method after receiving completed transactions, incase if autoFinishTransactions flag is turned off in billing settings.
InitializeStore()
Sends a request to retrieve localized information about the billing products from the Store.
Declaration
public static void InitializeStore()
Remarks
\note When the request completes, OnInitializeStoreComplete is fired.
InitializeStore(BillingProductDefinition[])
Sends a request to retrieve localized information about the billing products from the Store.
Declaration
public static void InitializeStore(BillingProductDefinition[] productDefinitions)
Parameters
Type | Name | Description |
---|---|---|
BillingProductDefinition[] | productDefinitions |
Remarks
\note When the request completes, OnInitializeStoreComplete is fired.
IsAvailable()
Declaration
public static bool IsAvailable()
Returns
Type | Description |
---|---|
System.Boolean |
IsProductPurchased(IBillingProduct)
Determines whether specified billing product is already purchased.
Declaration
public static bool IsProductPurchased(IBillingProduct product)
Parameters
Type | Name | Description |
---|---|---|
IBillingProduct | product | The object identifies the billing product registered in the Store. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
\note This works only for Non-Consumable (Managed) billing product. For Consumable products, this will always returns false.
RestorePurchases(String)
Sends a request to restore completed purchases.
Declaration
public static void RestorePurchases(string tag = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Application provided username that initiated this request. (optional) |
Remarks
\note Internally this feature requires consumable product information. So ensure that InitializeStore() is called prior to this.
Events
OnInitializeStoreComplete
Event that will be called when registered billing products are retreived from the Store.
Declaration
public static event EventCallback<BillingServicesInitializeStoreResult> OnInitializeStoreComplete
Event Type
Type | Description |
---|---|
EventCallback<BillingServicesInitializeStoreResult> |
OnRestorePurchasesComplete
Event that will be called when restored transaction details are received from the Store.
Declaration
public static event EventCallback<BillingServicesRestorePurchasesResult> OnRestorePurchasesComplete
Event Type
Type | Description |
---|---|
EventCallback<BillingServicesRestorePurchasesResult> |
OnTransactionStateChange
Event that will be called when payment state changes.
Declaration
public static event Callback<BillingServicesTransactionStateChangeResult> OnTransactionStateChange
Event Type
Type | Description |
---|---|
Callback<BillingServicesTransactionStateChangeResult> |