Skip to content

Most visited

Recently visited


Establishing In-app Billing Products for Sale

Before publishing your In-app Billing app, you must define the product list of digital goods available for purchase in the Google Play Console.

Specify in-app products in Google Play

From the Play Console, you can define product information for in-app products and associate a product list with your app.

To add new in-app products to your product list:

  1. Build a signed APK file for your In-app Billing app. To learn how to build and sign your APK, see Prepare for Release.
  2. In the Play Console, open the app entry that you created earlier.
  3. Click on the App releases in the left-hand menu and create a release to upload your APK. You can use any channel you want, and you can start with Beta or Alpha if you don't want to publish the app now. Check our support page for details on how to Prepare & rollout releases.
  4. Navigate to the uploaded app listing, and click on In-app Products.
  5. Click on the option to add a new product, then complete the form to specify the product information such as the item's unique product ID, also called its SKU, as well as a description, price, and country availability. Note down the product ID as you may need this information to query purchase details in your app later. To see a list of the products used by the TrivialDrive_v2 sample, review the UiDelegatesFactory class.

Note: The In-app Billing service only supports managed in-app products, so make sure that you specify that the purchase type is 'Managed' when you add new items to your product list in the Play Console.

  1. Once you have completed the form, activate the product so that your app can purchase it.

Query items available for purchase

You can query Google Play to programmatically retrieve details of the in-app products that are associated with your app, such as a product's price, title, description, and type. This query is useful, for example, when you want to display a listing of unowned items that are still available for purchase to users.

Note: When making a query, you must specify the product IDs for the products explicitly. You can manually find the product IDs from the Play Console by opening the In-app Products menu for your app. The product IDs are listed under the column labeled Name/ID.

To retrieve the product details, call the asynchronous querySkuDetailsAsync() method and pass it a reference to a listener that implements the SkuDetailsResponseListener interface and a reference to a SkuDetailsParams object with a SKU list and item type. The following code shows how you can integrate this method into the BillingManager class:

public void querySkuDetailsAsync(SkuDetailParams params, final SkuDetailsResponseListener listener) {
    // Create a runnable from the request to use inside the connection retry policy.
    Runnable queryRequest = new Runnable() {
        public void run() {
            // Create the SkuDetailParams object
            SkuDetailsParams.Builder params = SkuDetailsParams.newBuilder();
            // Run the query asynchronously.
            mBillingClient.querySkuDetailsAsync(, new SkuDetailsResponseListener() {
                        public void onSkuDetailsResponse(SkuDetailsResult result) {


You must implement a retry policy to handle possible interruptions to the connection between the Play Billing Library client and the In-app Billing service. You can add a generic retry mechanism to the BillingManager class that accepts the Runnable object from the previous code sample as follows:

private void executeServiceRequest(Runnable runnable) {
    if (mIsServiceConnected) {;
    } else {
        // If the billing service disconnects, try to reconnect once.

If the asynchronous query is successful, the query results are stored in a List of SkuDetails objects that is passed back to the listener. The following sample code shows how you can call the querySkuDetailsAsync() method in the BillingManager class from your UI and pass it a reference to an object that implements the SkuDetailsResponseListener interface:

private void addSkuRows(final List<SkuRowData> inList, List<String> skusList,
        final @SkuType String billingType, final Runnable executeWhenFinished) {

    mBillingProvider.getBillingManager().querySkuDetailsAsync(billingType, skusList,
            new SkuDetailsResponseListener() {
                public void onSkuDetailsResponse(@BillingResponse int responseCode,
                                                                         List<SkuDetails> skuDetailsList) {

                    if (result.getResponseCode() != BillingResponse.OK) {
                        // Handle any error responses.
                    } else if (skuDetailsList != null
                            && skuDetailsList.size() > 0) {
                            // Traverse through the list of SKUs inside SkuDetailsList.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Sigue a Google Developers en WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)