# BillingClient


```
public abstract class BillingClient
```

<br />

*** ** * ** ***

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.

It's strongly recommended that you instantiate only one BillingClient instance at one time to avoid multiple `https://developer.android.com/reference/com/android/billingclient/api/PurchasesUpdatedListener#onPurchasesUpdated(com.android.billingclient.api.BillingResult,java.util.List<com.android.billingclient.api.Purchase>)` callbacks for a single event.

All methods annotated with `https://developer.android.com/reference/androidx/annotation/AnyThread.html` can be called from any thread and all the asynchronous callbacks will be returned on the same thread. Methods annotated with `https://developer.android.com/reference/androidx/annotation/UiThread.html` should be called from the Ui thread and all the asynchronous callbacks will be returned on the Ui thread as well.

After instantiating, you must perform setup in order to start using the object. To perform setup, call the `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#startConnection(com.android.billingclient.api.BillingClientStateListener)` method and provide a listener; that listener will be notified when setup is complete, after which (and not before) you may start calling other methods. After setup is complete, you will typically want to request an inventory of owned items and subscriptions. See `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryPurchasesAsync(com.android.billingclient.api.QueryPurchasesParams,com.android.billingclient.api.PurchasesResponseListener)` and `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryProductDetailsAsync(com.android.billingclient.api.QueryProductDetailsParams,com.android.billingclient.api.ProductDetailsResponseListener)`.

When you are done with this object, don't forget to call `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#endConnection()` to ensure proper cleanup. This object holds a binding to the in-app billing service and the manager to handle broadcast events, which will leak unless you dispose it correctly. If you created the object inside the Activity.onCreate method, then the recommended place to dispose is the `https://developer.android.com/reference/android/app/Activity.html#onDestroy()` method. After cleanup, it cannot be reused again for connection.

To get library logs inside Android logcat, set corresponding logging level. E.g.: `
adb shell setprop log.tag.BillingClient VERBOSE`

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingProgram` Possible billing programs. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode` Possible response codes. |
| `public final class https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder` Builder to configure and create a `https://developer.android.com/reference/com/android/billingclient/api/BillingClient` instance. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.ConnectionState` Connection state of billing client. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType` Features/capabilities supported by `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isFeatureSupported(java.lang.String)`. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.OnPurchasesUpdatedSubResponseCode` Sub response codes further qualifying errors returned in `https://developer.android.com/reference/com/android/billingclient/api/PurchasesUpdatedListener#onPurchasesUpdated(com.android.billingclient.api.BillingResult,java.util.List<com.android.billingclient.api.Purchase>)`. |
| `@https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/java.lang.annotation.RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/com/android/billingclient/api/BillingClient.ProductType` Supported Product types. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#BillingClient()()` |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#acknowledgePurchase(com.android.billingclient.api.AcknowledgePurchaseParams,com.android.billingclient.api.AcknowledgePurchaseResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/AcknowledgePurchaseParams params, https://developer.android.com/reference/com/android/billingclient/api/AcknowledgePurchaseResponseListener listener )` Acknowledges in-app purchases. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#consumeAsync(com.android.billingclient.api.ConsumeParams,com.android.billingclient.api.ConsumeResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/ConsumeParams consumeParams, https://developer.android.com/reference/com/android/billingclient/api/ConsumeResponseListener listener )` Consumes a given in-app product. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createAlternativeBillingOnlyReportingDetailsAsync(com.android.billingclient.api.AlternativeBillingOnlyReportingDetailsListener)( https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyReportingDetailsListener listener )` Creates 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. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createBillingProgramReportingDetailsAsync(com.android.billingclient.api.BillingProgramReportingDetailsParams,com.android.billingclient.api.BillingProgramReportingDetailsListener)( https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsParams params, https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsListener listener )` Creates details required to report transactions made through billing programs outside of Google Play Billing using the External Transactions API. |
| `abstract void` | `[createExternalOfferReportingDetailsAsync](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createExternalOfferReportingDetailsAsync(com.android.billingclient.api.ExternalOfferReportingDetailsListener))( https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferReportingDetailsListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createBillingProgramReportingDetailsAsync(com.android.billingclient.api.BillingProgramReportingDetailsParams,com.android.billingclient.api.BillingProgramReportingDetailsListener)` with `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsListener` instead. <br /> |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#endConnection()()` Closes the connection and releases all held resources such as service connections. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#getBillingChoiceInfoAsync(com.android.billingclient.api.GetBillingChoiceInfoParams,com.android.billingclient.api.BillingChoiceInfoResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/GetBillingChoiceInfoParams params, https://developer.android.com/reference/com/android/billingclient/api/BillingChoiceInfoResponseListener listener )` Returns information about billing choice. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#getBillingConfigAsync(com.android.billingclient.api.GetBillingConfigParams,com.android.billingclient.api.BillingConfigResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/GetBillingConfigParams params, https://developer.android.com/reference/com/android/billingclient/api/BillingConfigResponseListener listener )` Gets the billing config, which stores configuration used to perform billing operations. |
| `abstract int` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#getConnectionState()()` Get the current billing client connection state. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isAlternativeBillingOnlyAvailableAsync(com.android.billingclient.api.AlternativeBillingOnlyAvailabilityListener)( https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyAvailabilityListener listener )` Checks the availability of offering alternative billing without user choice to use Google Play billing. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isBillingProgramAvailableAsync(int,com.android.billingclient.api.BillingProgramAvailabilityListener)( int billingProgram, https://developer.android.com/reference/com/android/billingclient/api/BillingProgramAvailabilityListener listener )` Checks the availability of a billing program. |
| `abstract void` | `[isExternalOfferAvailableAsync](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isExternalOfferAvailableAsync(com.android.billingclient.api.ExternalOfferAvailabilityListener))( https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferAvailabilityListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isBillingProgramAvailableAsync(int,com.android.billingclient.api.BillingProgramAvailabilityListener)` with `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramAvailabilityListener` instead. <br /> |
| `abstract https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isFeatureSupported(java.lang.String)(https://developer.android.com/reference/java/lang/String.html feature)` Checks if the specified feature or capability is supported by the Play Store. |
| `abstract boolean` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isReady()()` Checks if the client is currently connected to the service, so that requests to other methods will succeed. |
| `abstract https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#launchBillingFlow(android.app.Activity,com.android.billingclient.api.BillingFlowParams)(https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams params)` Initiates the billing flow for an in-app purchase or subscription. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#launchExternalLink(android.app.Activity,com.android.billingclient.api.LaunchExternalLinkParams,com.android.billingclient.api.LaunchExternalLinkResponseListener)( https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkParams params, https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkResponseListener listener )` Initiates linking out of the app for an external offer or app install. |
| `static https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#newBuilder(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context)` Constructs a new `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder` instance. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryProductDetailsAsync(com.android.billingclient.api.QueryProductDetailsParams,com.android.billingclient.api.ProductDetailsResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams params, https://developer.android.com/reference/com/android/billingclient/api/ProductDetailsResponseListener listener )` Performs a network query the details of products available for sale in your app. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#queryPurchasesAsync(com.android.billingclient.api.QueryPurchasesParams,com.android.billingclient.api.PurchasesResponseListener)( https://developer.android.com/reference/com/android/billingclient/api/QueryPurchasesParams queryPurchasesParams, https://developer.android.com/reference/com/android/billingclient/api/PurchasesResponseListener listener )` Returns purchases details for currently owned items bought within your app. |
| `abstract https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#showAlternativeBillingOnlyInformationDialog(android.app.Activity,com.android.billingclient.api.AlternativeBillingOnlyInformationDialogListener)( https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyInformationDialogListener listener )` Shows the alternative billing only information dialog on top of the calling app. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#showBillingProgramInformationDialog(android.app.Activity,com.android.billingclient.api.BillingProgramInformationDialogParams,com.android.billingclient.api.BillingProgramInformationDialogListener)( https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/BillingProgramInformationDialogParams params, https://developer.android.com/reference/com/android/billingclient/api/BillingProgramInformationDialogListener listener )` Shows the billing program information dialog on top of the calling app. |
| `abstract https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `[showExternalOfferInformationDialog](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#showExternalOfferInformationDialog(android.app.Activity,com.android.billingclient.api.ExternalOfferInformationDialogListener))( https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferInformationDialogListener listener )` **This method is deprecated.** Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#launchExternalLink(android.app.Activity,com.android.billingclient.api.LaunchExternalLinkParams,com.android.billingclient.api.LaunchExternalLinkResponseListener)` with `https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkResponseListener` instead. <br /> |
| `abstract https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#showInAppMessages(android.app.Activity,com.android.billingclient.api.InAppMessageParams,com.android.billingclient.api.InAppMessageResponseListener)( https://developer.android.com/reference/android/app/Activity.html activity, https://developer.android.com/reference/com/android/billingclient/api/InAppMessageParams params, https://developer.android.com/reference/com/android/billingclient/api/InAppMessageResponseListener listener )` Overlays billing related messages on top of the calling app. |
| `abstract void` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#startConnection(com.android.billingclient.api.BillingClientStateListener)(https://developer.android.com/reference/com/android/billingclient/api/BillingClientStateListener listener)` Starts up BillingClient setup process asynchronously. |

## Public constructors

### BillingClient

```
public BillingClient()
```

## Public methods

### acknowledgePurchase

```
public abstract void acknowledgePurchase(
    AcknowledgePurchaseParams params,
    AcknowledgePurchaseResponseListener listener
)
```

Acknowledges in-app purchases.

Developers are required to acknowledge that they have granted entitlement for all in-app purchases for their application.

**Warning!** All purchases require acknowledgement. Failure to acknowledge a purchase will result in that purchase being refunded. For one-time products ensure you are using `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#consumeAsync(com.android.billingclient.api.ConsumeParams,com.android.billingclient.api.ConsumeResponseListener)` which acts as an implicit acknowledgement or you can explicitly acknowledge the purchase via this method. For subscriptions use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#acknowledgePurchase(com.android.billingclient.api.AcknowledgePurchaseParams,com.android.billingclient.api.AcknowledgePurchaseResponseListener)`. Please refer to the [integration guide](https://developer.android.com/google/play/billing/integrate#process) for more details.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/AcknowledgePurchaseParams params` | Params specific to this acknowledge purchase request. |
| `https://developer.android.com/reference/com/android/billingclient/api/AcknowledgePurchaseResponseListener listener` | The listener for the result of the acknowledge operation returned asynchronously through the callback with the `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode`. |

### consumeAsync

```
public abstract void consumeAsync(
    ConsumeParams consumeParams,
    ConsumeResponseListener listener
)
```

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.

Consumption is done asynchronously and the listener receives the callback specified upon completion.

**Warning!** All purchases require acknowledgement. Failure to acknowledge a purchase will result in that purchase being refunded. For one-time products ensure you are using this method which acts as an implicit acknowledgement or you can explicitly acknowledge the purchase via `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#acknowledgePurchase(com.android.billingclient.api.AcknowledgePurchaseParams,com.android.billingclient.api.AcknowledgePurchaseResponseListener)`. For subscriptions use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#acknowledgePurchase(com.android.billingclient.api.AcknowledgePurchaseParams,com.android.billingclient.api.AcknowledgePurchaseResponseListener)`. Please refer to https://developer.android.com/google/play/billing/billing_library_overview#acknowledge for more details.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/ConsumeParams consumeParams` | Params specific to consuming a purchase. |
| `https://developer.android.com/reference/com/android/billingclient/api/ConsumeResponseListener listener` | The listener for the result of the consume operation returned asynchronously through the callback with the purchase token and `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode`. |

### createAlternativeBillingOnlyReportingDetailsAsync

```
public abstract void createAlternativeBillingOnlyReportingDetailsAsync(
    AlternativeBillingOnlyReportingDetailsListener listener
)
```

Creates 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.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyReportingDetailsListener listener` | The listener for the response of the create alternative billing only reporting details flow. |

### createBillingProgramReportingDetailsAsync

```
public abstract void createBillingProgramReportingDetailsAsync(
    BillingProgramReportingDetailsParams params,
    BillingProgramReportingDetailsListener listener
)
```

Creates details required to report transactions made through billing programs outside of Google Play Billing using the External Transactions API.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsParams params` | Params necessary to create the reporting details for transaction reporting. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsListener listener` | The listener for the response of the create billing program reporting details flow. |

### createExternalOfferReportingDetailsAsync

```
public abstract void [createExternalOfferReportingDetailsAsync](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createExternalOfferReportingDetailsAsync(com.android.billingclient.api.ExternalOfferReportingDetailsListener))(
    ExternalOfferReportingDetailsListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#createBillingProgramReportingDetailsAsync(com.android.billingclient.api.BillingProgramReportingDetailsParams,com.android.billingclient.api.BillingProgramReportingDetailsListener)` with `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramReportingDetailsListener` instead.

Creates purchase details that can be used to report a transaction made via external offer.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferReportingDetailsListener listener` | The listener for the response of the create external offer reporting details flow. |

### endConnection

```
public abstract void endConnection()
```

Closes the connection and releases all held resources such as service connections.

Call this method once you are done with this BillingClient reference, and when Activity or Fragment is destroyed to avoid memory leak.

### getBillingChoiceInfoAsync

```
public abstract void getBillingChoiceInfoAsync(
    GetBillingChoiceInfoParams params,
    BillingChoiceInfoResponseListener listener
)
```

Returns information about billing choice.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/GetBillingChoiceInfoParams params` | Params necessary to get the billing choice info. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingChoiceInfoResponseListener listener` | The listener for the response containing the billing choice info for the user locale specified in `https://developer.android.com/reference/com/android/billingclient/api/GetBillingChoiceInfoParams`, or the user's default locale if not specified. |

### getBillingConfigAsync

```
public abstract void getBillingConfigAsync(
    GetBillingConfigParams params,
    BillingConfigResponseListener listener
)
```

Gets the billing config, which stores configuration used to perform billing operations.

Note: This data can change and should not be cached.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/GetBillingConfigParams params` | Params specific to this get billing config request. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingConfigResponseListener listener` | The listener for the response of the get billing config flow. |

### getConnectionState

```
public abstract int getConnectionState()
```

Get the current billing client connection state.

| Returns |
|---|---|
| `int` | The `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.ConnectionState` corresponding to the current client connection state. |

### isAlternativeBillingOnlyAvailableAsync

```
public abstract void isAlternativeBillingOnlyAvailableAsync(
    AlternativeBillingOnlyAvailabilityListener listener
)
```

Checks the availability of offering alternative billing without user choice to use Google Play billing.

Note: This data can change and should not be cached.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyAvailabilityListener listener` | The listener for the response of the alternative billing only availability. |

### isBillingProgramAvailableAsync

```
public abstract void isBillingProgramAvailableAsync(
    int billingProgram,
    BillingProgramAvailabilityListener listener
)
```

Checks the availability of a billing program.

Note: This data can change and should not be cached.

| Parameters |
|---|---|
| `int billingProgram` | The billing program to check the availability for. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramAvailabilityListener listener` | The listener for the response of the billing program availability. |

### isExternalOfferAvailableAsync

```
public abstract void [isExternalOfferAvailableAsync](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isExternalOfferAvailableAsync(com.android.billingclient.api.ExternalOfferAvailabilityListener))(
    ExternalOfferAvailabilityListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#isBillingProgramAvailableAsync(int,com.android.billingclient.api.BillingProgramAvailabilityListener)` with `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramAvailabilityListener` instead.

Checks the availability of providing external offer.

Note: This data can change and should not be cached.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferAvailabilityListener listener` | The listener for the response of the external offer availability. |

### isFeatureSupported

```
public abstract BillingResult isFeatureSupported(String feature)
```

Checks if the specified feature or capability is supported by the Play Store.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html feature` | One of the `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType` constants. |

| Returns |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#OK()` if the feature is supported, `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#FEATURE_NOT_SUPPORTED()` if the feature is not supported, and `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#SERVICE_DISCONNECTED()` if the client is not connected to the Play Store service. |

### isReady

```
public abstract boolean isReady()
```

Checks if the client is currently connected to the service, so that requests to other methods will succeed.

Returns true if the client is currently connected to the service, false otherwise.

### launchBillingFlow

```
public abstract BillingResult launchBillingFlow(Activity activity, BillingFlowParams params)
```

Initiates the billing flow for an in-app purchase or subscription.

It will show the Google Play purchase screen. The result will be delivered via the `https://developer.android.com/reference/com/android/billingclient/api/PurchasesUpdatedListener` interface implementation set by `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder#setListener(com.android.billingclient.api.PurchasesUpdatedListener)`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference from which the billing flow will be launched. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams params` | Params specific to the launch billing flow request. |

| Returns |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | The result of the launch billing flow operation. `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#ITEM_ALREADY_OWNED()` if the user already owns the item being purchased, `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#ITEM_UNAVAILABLE()` if the item is not available to be purchased, and `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#USER_CANCELED()` if the user dismissed the purchase flow. |

### launchExternalLink

```
public abstract void launchExternalLink(
    Activity activity,
    LaunchExternalLinkParams params,
    LaunchExternalLinkResponseListener listener
)
```

Initiates linking out of the app for an external offer or app install.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference from which the external link will be launched. |
| `https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkParams params` | Params specific to the external link request. |
| `https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkResponseListener listener` | The listener for the response of the external link flow. |

### newBuilder

```
public static BillingClient.Builder newBuilder(Context context)
```

Constructs a new `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.Builder` instance.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | It will be used to get an application context to bind to the in-app billing service. |

### queryProductDetailsAsync

```
public abstract void queryProductDetailsAsync(
    QueryProductDetailsParams params,
    ProductDetailsResponseListener listener
)
```

Performs a network query the details of products available for sale in your app.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/QueryProductDetailsParams params` | Params containing list of Product where each product contains product id and `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.ProductType`. |
| `https://developer.android.com/reference/com/android/billingclient/api/ProductDetailsResponseListener listener` | The listener for the result of the query operation returned asynchronously through the callback with the `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode`. |

### queryPurchasesAsync

```
public abstract void queryPurchasesAsync(
    QueryPurchasesParams queryPurchasesParams,
    PurchasesResponseListener listener
)
```

Returns purchases details for currently owned items bought within your app.

Only active subscriptions and non-consumed one-time purchases are returned.

Note: It's recommended for security purposes to go through purchases verification on your backend (if you have one) by calling one of the following APIs: https://developers.google.com/android-publisher/api-ref/purchases/products/get https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/QueryPurchasesParams queryPurchasesParams` | Params specific to this query request. |
| `https://developer.android.com/reference/com/android/billingclient/api/PurchasesResponseListener listener` | The listener for the result of the query returned asynchronously through the callback with the `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` and the list of `https://developer.android.com/reference/com/android/billingclient/api/Purchase`. |

### showAlternativeBillingOnlyInformationDialog

```
public abstract BillingResult showAlternativeBillingOnlyInformationDialog(
    Activity activity,
    AlternativeBillingOnlyInformationDialogListener listener
)
```

Shows the alternative billing only information dialog on top of the calling app.

If this dialog has previously been shown and acknowledged by the user on the app and device, it won't be shown again.

The listener will be invoked on the UI thread on completion.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference to host the rendering of the alternative billing only dialog. |
| `https://developer.android.com/reference/com/android/billingclient/api/AlternativeBillingOnlyInformationDialogListener listener` | The listener for the response of the alternative billing only dialog. |

| Returns |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#OK()` if the request is successfully submitted to Play Store, or an error code otherwise. |

### showBillingProgramInformationDialog

```
public abstract void showBillingProgramInformationDialog(
    Activity activity,
    BillingProgramInformationDialogParams params,
    BillingProgramInformationDialogListener listener
)
```

Shows the billing program information dialog on top of the calling app.

If this dialog has previously been shown and acknowledged by the user on the app and device, it won't be shown again.

The listener will be invoked on the UI thread on completion.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference to host the rendering of the information dialog. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramInformationDialogParams params` | Params specific to the billing program information dialog request. |
| `https://developer.android.com/reference/com/android/billingclient/api/BillingProgramInformationDialogListener listener` | The listener for the response of the information dialog. |

### showExternalOfferInformationDialog

```
public abstract BillingResult [showExternalOfferInformationDialog](https://developer.android.com/reference/com/android/billingclient/api/BillingClient#showExternalOfferInformationDialog(android.app.Activity,com.android.billingclient.api.ExternalOfferInformationDialogListener))(
    Activity activity,
    ExternalOfferInformationDialogListener listener
)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/android/billingclient/api/BillingClient#launchExternalLink(android.app.Activity,com.android.billingclient.api.LaunchExternalLinkParams,com.android.billingclient.api.LaunchExternalLinkResponseListener)` with `https://developer.android.com/reference/com/android/billingclient/api/LaunchExternalLinkResponseListener` instead.

Shows the external offer information dialog on top of the calling app.

The listener will be invoked on the UI thread on completion.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference to host the rendering of the external offer information dialog. |
| `https://developer.android.com/reference/com/android/billingclient/api/ExternalOfferInformationDialogListener listener` | The listener for the response of the external offer information dialog. |

| Returns |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#OK()` if the request is successfully submitted to Play Store, or an error code otherwise. |

### showInAppMessages

```
public abstract BillingResult showInAppMessages(
    Activity activity,
    InAppMessageParams params,
    InAppMessageResponseListener listener
)
```

Overlays billing related messages on top of the calling app.

For example, show a message to inform users that their subscription payment has been declined or that there is an outstanding opt-in price increase requiring user confirmation. This provides options to take them to fix their payment method or confirm the price increase.

Callback will be returned on UI thread.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/app/Activity.html activity` | An activity reference to host the rendering of in-app messages. |
| `https://developer.android.com/reference/com/android/billingclient/api/InAppMessageParams params` | Params specific to this show in-app messages request. |
| `https://developer.android.com/reference/com/android/billingclient/api/InAppMessageResponseListener listener` | The listener for the result response of the in-app messaging flow. |

| Returns |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingResult` | `https://developer.android.com/reference/com/android/billingclient/api/BillingClient.BillingResponseCode#OK()` if the request is successfully submitted to Play Store, or an error code otherwise. |

### startConnection

```
public abstract void startConnection(BillingClientStateListener listener)
```

Starts up BillingClient setup process asynchronously. You will be notified through the `https://developer.android.com/reference/com/android/billingclient/api/BillingClientStateListener` listener when the setup process is complete.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/android/billingclient/api/BillingClientStateListener listener` | The listener to notify when the setup process is complete. |