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(IAppCoinsBillingStateListener appCoinsBillingStateListener, IConsumeResponseListener consumeResponseListener, IPurchasesUpdatedListener purchasesUpdatedListener, ISkuDetailsResponseListener skuDetailsResponseListener, string publicKey, string className)

Initializes the plugin with the required listeners and configuration.

Parameters

NameTypeDescription
appCoinsBillingStateListenerIAppCoinsBillingStateListenerListener for billing state changes.
consumeResponseListenerIConsumeResponseListenerListener for consume responses.
purchasesUpdatedListenerIPurchasesUpdatedListenerListener for purchase updates.
skuDetailsResponseListenerISkuDetailsResponseListenerListener for SKU 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.


QuerySkuDetailsAsync

static void QuerySkuDetailsAsync(string[] skus, string skuType)

Asynchronously retrieves SKU details for the specified SKUs.

Parameters

NameTypeDescription
skusString[]Array of SKU identifiers to query.
skuTypeStringType of SKUs to query (e.g., in-app).

LaunchBillingFlow

static int LaunchBillingFlow(string sku, string skuType, string developerPayload)

Launches the billing flow for a specified SKU.

Parameters

NameTypeDescription
skuStringSKU identifier for the product to purchase.
skuTypeStringType of SKU (e.g., in-app).
developerPayloadStringDeveloper-specific payload for verification.

Returns

Integer value representing the response code of the operation.


ConsumeAsync

static void ConsumeAsync(string purchaseToken)

Consumes a previously purchased product.

Parameters

NameTypeDescription
purchaseTokenStringToken identifying the purchase to consume.

IsFeatureSupported

static int IsFeatureSupported(string feature)

Checks whether a specific feature is supported.

Parameters

NameTypeDescription
featureStringName of the feature to check.

Returns

Integer value representing the response code of the operation.


QueryPurchases

static PurchasesResult QueryPurchases(string skuType)

Queries the purchases for a specific SKU type.

Parameters

NameTypeDescription
skuTypeStringType of SKUs to query.

Returns

A PurchasesResult containing the results.


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. SkuDetailsResponseCallback: Handles responses for SKU details.
  5. ConsumeResponseCallback: Handles responses for consume operations.