API reference
API reference
Select your platform
No SDKs available
No versions available

BillingClient

Updated: May 13, 2025

BillingClient

abstract class BillingClient
Main interface for communication between the library and user application code.
It provides convenience methods for in-app billing. You can create one instance of this class for your application and use it to process in-app billing operations. It provides synchronous (blocking) and asynchronous (non-blocking) methods for many common in-app billing operations.
The equivalent Google Play Billing Library class can be found at the Android developer documentation for BillingClient.

Constructors

NameSummary
BillingClient
constructor()

Types

NameSummary
annotation class AgeCategory
Age Category of the user.
annotation class BillingResponseCode
Possible response codes.
class Builder
Builder to configure and create a BillingClient instance.
Companion
object Companion
annotation class ConnectionState
Connection state of billing client.
annotation class FeatureType
Features/capabilities supported by isFeatureSupported.
annotation class ProductType
Supported Product types.
annotation class SkuType
Supported SKU types.

Functions

NameSummary
acknowledgePurchase
abstract fun acknowledgePurchase(params: AcknowledgePurchaseParams, listener: <Error class: unknown class>)
Acknowledges in-app purchases.
consumeAsync
abstract fun consumeAsync(params: ConsumeParams, listener: <Error class: unknown class>)
Consumes a given in-app product. Consuming can only be done on an item that’s owned, and as a result of consumption, the user will no longer own it.
createAlternativeBillingOnlyReportingDetailsAsync
abstract fun createAlternativeBillingOnlyReportingDetailsAsync(listener: <Error class: unknown class>)
Google Play Billing Library allows developers to create alternative billing only purchase details that can be used to report a transaction made via alternative billing without user choice to use Google Play billing.
createExternalOfferReportingDetailsAsync
abstract fun createExternalOfferReportingDetailsAsync(listener: <Error class: unknown class>)
Creates purchase details that can be used to report a transaction made via external offer.
endConnection
abstract fun endConnection()
Closes the connection and releases all held resources such as service connections.
getBillingConfigAsync
abstract fun getBillingConfigAsync(params: GetBillingConfigParams, listener: <Error class: unknown class>)
Gets the billing config, which stores configuration used to perform billing operations.
getConnectionState
abstract fun getConnectionState(): Int
Get the current billing client connection state.
isAlternativeBillingOnlyAvailableAsync
abstract fun isAlternativeBillingOnlyAvailableAsync(listener: <Error class: unknown class>)
In the Google Play Billing Library, this checks the availability of offering alternative billing without user choice to use Google Play billing.
isExternalOfferAvailableAsync
abstract fun isExternalOfferAvailableAsync(listener: <Error class: unknown class>)
Checks the availability of providing external offer.
isFeatureSupported
abstract fun isFeatureSupported(feature: String): BillingResult
Checks if the specified feature or capability is supported.
isReady
abstract fun isReady(): Boolean
Checks if the client is currently connected to the service, so that requests to other methods will succeed.
launchBillingFlow
abstract fun launchBillingFlow(activity: <Error class: unknown class>, params: BillingFlowParams): BillingResult
Initiates the billing flow for an in-app purchase or subscription.
launchPriceChangeConfirmationFlow
abstract fun launchPriceChangeConfirmationFlow(activity: <Error class: unknown class>, params: PriceChangeFlowParams, listener: <Error class: unknown class>)
Launch a price change confirmation flow.
queryAgeCategoryAsync
abstract fun queryAgeCategoryAsync(listener: <Error class: unknown class>)
Returns the AgeCategory of the user.
queryProductDetailsAsync
abstract fun queryProductDetailsAsync(params: QueryProductDetailsParams, listener: <Error class: unknown class>)
Performs a network query the details of products available for sale in your app.
queryPurchaseHistoryAsync
abstract fun queryPurchaseHistoryAsync(queryPurchaseHistoryParams: QueryPurchaseHistoryParams, listener: <Error class: unknown class>)
abstract fun queryPurchaseHistoryAsync(skuType: String, listener: <Error class: unknown class>)
Returns purchases details for items bought within your app. Only the most recent purchase made by the user for each SKU is returned.
queryPurchasesAsync
abstract fun queryPurchasesAsync(queryPurchasesParams: QueryPurchasesParams, listener: <Error class: unknown class>)
abstract fun queryPurchasesAsync(skuType: String, listener: <Error class: unknown class>)
Returns purchases details for currently owned items bought within your app.
querySkuDetailsAsync
abstract fun querySkuDetailsAsync(params: SkuDetailsParams, listener: <Error class: unknown class>)
Performs a network query to get SKU details and return the result asynchronously.
showAlternativeBillingOnlyInformationDialog
abstract fun showAlternativeBillingOnlyInformationDialog(activity: <Error class: unknown class>, listener: <Error class: unknown class>): BillingResult
Shows the alternative billing only information dialog on top of the calling app.
showExternalOfferInformationDialog
abstract fun showExternalOfferInformationDialog(activity: <Error class: unknown class>, listener: <Error class: unknown class>): BillingResult
Shows the external offer information dialog on top of the calling app.
showInAppMessages
abstract fun showInAppMessages(activity: <Error class: unknown class>, params: InAppMessageParams, listener: <Error class: unknown class>): BillingResult
Overlays billing related messages on top of the calling app.
startConnection
abstract fun startConnection(listener: BillingClientStateListener)
Starts up BillingClient setup process asynchronously. You will be notified through the BillingClientStateListener listener when the setup process is complete.

Companion

object Companion

Properties

NameSummary
connectionState
var connectionState: Int

Functions

NameSummary
newBuilder
fun newBuilder(context: <Error class: unknown class>): BillingClient.Builder
Did you find this page helpful?
Thumbs up icon
Thumbs down icon