AptoideBillingSDKManager
The AptoideBillingSDKManager
serves as the main interface for handling in-app billing operations in Unity applications. It facilitates operations such as querying purchases, retrieving product details, consuming purchases, and managing billing flows. Additionally, it provides utilities for app updates and referral deeplinks.
To use the AptoideBillingSDKManager
, initialize it using the InitializePlugin
method, passing the required listeners, public key, and class name. The SDK ensures a seamless integration with Aptoide's billing system by managing the connection with the underlying Android bridge.
Public Methods
InitializePlugin
static void InitializePlugin(IAptoideBillingClientStateListener aptoideBillingClientStateListener, IConsumeResponseListener consumeResponseListener, IPurchasesUpdatedListener purchasesUpdatedListener, IPurchasesResponseListener purchasesResponseListener, IProductDetailsResponseListener productDetailsResponseListener, string publicKey, string className)
Initializes the plugin with the required listeners and configuration.
Parameters
Name | Type | Description |
---|---|---|
aptoideBillingClientStateListener | IAptoideBillingClientStateListener | Listener for billing state changes. |
consumeResponseListener | IConsumeResponseListener | Listener for consume responses. |
purchasesUpdatedListener | IPurchasesUpdatedListener | Listener for purchase updates. |
purchasesResponseListener | IPurchasesResponseListener | Listener for purchase querying response. |
productDetailsResponseListener | IProductDetailsResponseListener | Listener for Product details responses. |
publicKey | String | Public key for validating purchases. |
className | String | Class name associated with the billing SDK bridge. |
Initialize
static void Initialize(string publicKey, string className)
Initializes the Android bridge with the provided public key and class name.
StartConnection
static void StartConnection()
Starts the connection to the billing system.
EndConnection
static void EndConnection()
Ends the connection to the billing system, releasing resources.
IsReady
static bool IsReady()
Checks if the billing system is ready for operations.
Returns
Boolean value indicating the readiness of the system.
QueryProductDetailsAsync
static void QueryProductDetailsAsync(QueryProductDetailsParams queryProductDetailsParams)
Asynchronously retrieves Product details for the specified Product IDs.
Parameters
Name | Type | Description |
---|---|---|
queryProductDetailsParams | QueryProductDetailsParams | Parameters for the Purchases to be queried. |
LaunchBillingFlow
static BillingResult LaunchBillingFlow(BillingFlowParams billingFlowParams)
Launches the billing flow for a specified SKU.
Parameters
Name | Type | Description |
---|---|---|
billingFlowParams | BillingFlowParams | Parameters for the billing flow. |
Returns
Billing result of type BillingResult of the response received.
ConsumeAsync
static void ConsumeAsync(ConsumeParams consumeParams)
Consumes a previously purchased product.
Parameters
Name | Type | Description |
---|---|---|
consumeParams | ConsumeParams | Params of the purchase to be consumed. |
IsFeatureSupported
static BillingResult IsFeatureSupported(int feature)
Checks whether a specific feature is supported.
Parameters
Name | Type | Description |
---|---|---|
feature | int | Value of the feature to check. |
Returns
Billing result of type BillingResult of the response received.
QueryPurchasesAsync
static void QueryPurchasesAsync(QueryPurchasesParams queryPurchasesParams)
Retrieves asynchronously the purchases associated with the user based on the specified QueryPurchasesParams
to the iPurchasesResponseListener
.
Parameters
Name | Type | Description |
---|---|---|
queryPurchasesParams | QueryPurchasesParams | Parameters for the Purchases to be queried. |
GetReferralDeeplink
static ReferralDeeplinkResult GetReferralDeeplink()
Retrieves a referral deeplink associated with the application.
Returns
A ReferralDeeplinkResult
with the deeplink details.
IsAppUpdateAvailable
static bool IsAppUpdateAvailable()
Checks if an application update is available.
Returns
Boolean value indicating whether an update is available.
LaunchAppUpdateDialog
static void LaunchAppUpdateDialog()
Displays a dialog prompting the user to update the application.
LaunchAppUpdateStore
static void LaunchAppUpdateStore()
Launches the store page for updating the application.
Callback Handlers
The following callback methods handle responses from the Android bridge:
- BillingSetupFinishedCallback: Invoked when billing setup is complete.
- BillingServiceDisconnectedCallback: Invoked when the billing service is disconnected.
- PurchasesUpdatedCallback: Handles updates to purchases.
- PurchasesResponseCallback: Handles purchases querying results.
- ProductDetailsResponseCallback: Handles responses for Product details.
- ConsumeResponseCallback: Handles responses for consume operations.
Updated 1 day ago