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
Name | Type | Description |
---|---|---|
appCoinsBillingStateListener | IAppCoinsBillingStateListener | Listener for billing state changes. |
consumeResponseListener | IConsumeResponseListener | Listener for consume responses. |
purchasesUpdatedListener | IPurchasesUpdatedListener | Listener for purchase updates. |
skuDetailsResponseListener | ISkuDetailsResponseListener | Listener for SKU 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.
QuerySkuDetailsAsync
static void QuerySkuDetailsAsync(string[] skus, string skuType)
Asynchronously retrieves SKU details for the specified SKUs.
Parameters
Name | Type | Description |
---|---|---|
skus | String[] | Array of SKU identifiers to query. |
skuType | String | Type 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
Name | Type | Description |
---|---|---|
sku | String | SKU identifier for the product to purchase. |
skuType | String | Type of SKU (e.g., in-app). |
developerPayload | String | Developer-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
Name | Type | Description |
---|---|---|
purchaseToken | String | Token identifying the purchase to consume. |
IsFeatureSupported
static int IsFeatureSupported(string feature)
Checks whether a specific feature is supported.
Parameters
Name | Type | Description |
---|---|---|
feature | String | Name 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
Name | Type | Description |
---|---|---|
skuType | String | Type 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:
- BillingSetupFinishedCallback: Invoked when billing setup is complete.
- BillingServiceDisconnectedCallback: Invoked when the billing service is disconnected.
- PurchasesUpdatedCallback: Handles updates to purchases.
- SkuDetailsResponseCallback: Handles responses for SKU details.
- ConsumeResponseCallback: Handles responses for consume operations.
Updated 3 days ago