![]() |
Essential Kit
|
Provides cross-platform interface to request payment from a user for additional functionality or content that your application delivers.
More...
Static Public Member Functions | |
static void | InitializeStore () |
Sends a request to retrieve localized information about the billing products from the Store. | |
static void | InitializeStore (BillingProductDefinition[] productDefinitions) |
Sends a request to retrieve localized information about the billing products from the Store. | |
static IBillingProduct | GetProductWithId (string id, bool includeInactive=false) |
Gets the billing product with localized information, which was previously fetched from the Store. | |
static bool | CanMakePayments () |
Determines whether the user is authorised to make payments. | |
static bool | IsProductPurchased (string productId) |
Determines whether specified billing product is already purchased. | |
static bool | IsProductPurchased (IBillingProduct product) |
Determines whether specified billing product is already purchased. | |
static void | BuyProduct (string productId, BuyProductOptions options=null) |
Initiates purchase process for the specified billing product. | |
static void | BuyProduct (IBillingProduct product, BuyProductOptions options=null) |
Initiates purchase process for the specified billing product. | |
static IBillingTransaction[] | GetTransactions () |
Returns the pending transactions available in transaction queue. | |
static void | FinishTransactions (IBillingTransaction[] transactions) |
Completes the pending transactions and removes it from transaction queue. | |
static void | RestorePurchases (bool forceRefresh=false, string tag=null) |
Advanced Usage | |
static void | Initialize (BillingServicesUnitySettings settings) |
Initializes the billing services module with the given settings. This call is optional and only need to be called if you have custom settings to initialize this feature. | |
Obsolete methods | |
static bool | BuyProduct (string productId, int quantity=1, string applicationUsername=null) |
Initiates purchase process for the specified billing product. | |
static bool | BuyProduct (IBillingProduct product, int quantity=1, string applicationUsername=null) |
Initiates purchase process for the specified billing product. | |
static void | RestorePurchases (string tag=null) |
Initiates purchase process for the specified billing product. | |
Properties | |
static IBillingProduct[] | Products [get] |
Returns the cached products array retrieved from store. | |
Events | |
static EventCallback< BillingServicesInitializeStoreResult > | OnInitializeStoreComplete |
Event that will be called when registered billing products are retreived from the Store. | |
static Callback< BillingServicesTransactionStateChangeResult > | OnTransactionStateChange |
Event that will be called when payment state changes. | |
static EventCallback< BillingServicesRestorePurchasesResult > | OnRestorePurchasesComplete |
Event that will be called when restored transaction details are received from the Store. | |
This feature connects to the Store on your app’s behalf to securely process payments from users, prompting them to authorize payment. The feature then notifies your app, which provides the purchased items to users. For processing requests, feature contacts App Store, Google Play Store on iOS, Android platform respectively. You need to configure iOS billing product details at iTunes Connect. Similarly for Android, you can set these details at Google Play Developer Console.
The interaction between the user, your app, and the Store during the purchase process take place in three stages. First, the your app displays purchasable products received from the Store. Second, the user selects a product to buy and the app requests payment from the Store. Third, the Store processes the payment and your app delivers the purchased product.
Optionally, you can choose to verify receipts of completed transactions. The receipt is a record of purchase made from within the application and enabling receipt validation, adds one more level security to avoid unauthorised purchases.
Users can also restore products that were previously purchased. As per iOS guidelines, if your application supports product types that are restorable, you must include an interface that allows users to restore these purchases.
|
static |
settings | The settings to be used for initialization. |
The settings configure the default image to be used for products.
References BillingServices.OnInitializeStoreComplete, BillingServices.OnRestorePurchasesComplete, BillingServices.OnTransactionStateChange, and BillingServices.Products.
|
static |
Call to this method retrieves information of the products that are configured in Billing Settings
. Your application uses this request to present localized prices and other information to the user without having to maintain that list itself.
References BillingServices.InitializeStore(), and BillingServicesUnitySettings.Products.
Referenced by BillingServices.InitializeStore().
|
static |
Call to this method retrieves information of the products that are configured in Billing Settings
. Your application uses this request to present localized prices and other information to the user without having to maintain that list itself.
References BillingServices.OnInitializeStoreComplete.
|
static |
id | A string used to identify a billing product. |
includeInactive | Whether inactive products should be considered in search. Default is false. |
References BillingServices.Products.
Referenced by BillingServices.BuyProduct(), and BillingServices.IsProductPurchased().
|
static |
true
if the user is allowed to make product purchase payment; otherwise, false
.
|
static |
true
if specified billing product is already purchased; otherwise, false
.productId | The identifier of the billing product. |
References BillingServices.GetProductWithId(), and BillingServices.IsProductPurchased().
Referenced by BillingServices.IsProductPurchased().
|
static |
true
if specified billing product is already purchased; otherwise, false
.product | The object identifies the billing product registered in the Store. |
|
static |
productId | The product you want to purchase. |
options | Additional options for the purchase. |
References BillingServices.BuyProduct(), and BillingServices.GetProductWithId().
Referenced by BillingServices.BuyProduct().
|
static |
product | The product you want to purchase. |
options | Create BuyProductOptions object to set custom quantity and purchase tag. |
References BuyProductOptions.Default, IBillingProduct.Id, and IBillingProduct.PlatformId.
|
static |
///
|
static |
transactions | An array of unfinished transactions. |
|
static |
Sends a request to restore completed purchases.
Your application calls this method to restore transactions that were previously purchased so that you can process them again.
forceRefresh | If set to true force refresh by contacting server. On iOS this will trigger a login prompt to let user signin. So set this to true only if user clicks manually "Restore" option in IAP screens. |
tag | This can be a unique identifier which was passed in BuyProductOptions when purchasing a product. Usually, this can be the application username or any unique identifier for which you want to restore purchases for. (optional) |
|
static |
true
, if request was initiated, false
otherwise failed. This can happen if product is not foundproductId | The product you want to purchase. |
quantity | The number of units you want to purchase. Default quantity value is 1. |
applicationUsername | Application provided username that initiated this request. (optional) |
|
static |
true
, if request was initiated, false
otherwise failed. This can happen if product is not foundproduct | The product you want to purchase. |
quantity | The number of units you want to purchase. Default quantity value is 1. |
applicationUsername | Specify user data associated with the purchase. Eg: Application provided username that initiated this request. (optional) |
|
static |
true
, if request was initiated, false
otherwise failed. This can happen if product is not foundproductId | The product you want to purchase. |
quantity | The number of units you want to purchase. Default quantity value is 1. |
applicationUsername | Application provided username that initiated this request. (optional) |
|
staticget |
Referenced by BillingServices.GetProductWithId(), and BillingServices.Initialize().