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

NameTypeDescription
aptoideBillingClientStateListenerIAptoideBillingClientStateListenerListener for billing state changes.
consumeResponseListenerIConsumeResponseListenerListener for consume responses.
purchasesUpdatedListenerIPurchasesUpdatedListenerListener for purchase updates.
purchasesResponseListenerIPurchasesResponseListenerListener for purchase querying response.
productDetailsResponseListenerIProductDetailsResponseListenerListener for Product details responses.
publicKeyStringPublic key for validating purchases.
classNameStringClass 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

NameTypeDescription
queryProductDetailsParamsQueryProductDetailsParamsParameters for the Purchases to be queried.

LaunchBillingFlow

static BillingResult LaunchBillingFlow(BillingFlowParams billingFlowParams)

Launches the billing flow for a specified SKU.

Parameters

NameTypeDescription
billingFlowParamsBillingFlowParamsParameters 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

NameTypeDescription
consumeParamsConsumeParamsParams of the purchase to be consumed.

IsFeatureSupported

static BillingResult IsFeatureSupported(int feature)

Checks whether a specific feature is supported.

Parameters

NameTypeDescription
featureintValue 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

NameTypeDescription
queryPurchasesParamsQueryPurchasesParamsParameters 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:

  1. BillingSetupFinishedCallback: Invoked when billing setup is complete.
  2. BillingServiceDisconnectedCallback: Invoked when the billing service is disconnected.
  3. PurchasesUpdatedCallback: Handles updates to purchases.
  4. PurchasesResponseCallback: Handles purchases querying results.
  5. ProductDetailsResponseCallback: Handles responses for Product details.
  6. ConsumeResponseCallback: Handles responses for consume operations.