page.title=Administering In-app Billing parent.title=In-app Billing parent.link=index.html @jd:body

In this document

  1. Creating a Product List
  2. Choosing a Product Type
  3. Setting up Test Accounts
  4. Handling Refunds
  5. Working with Order Numbers
  6. Where to Get Support

See also

  1. Overview of In-app Billing

In-app billing frees you from processing financial transactions, but you still need to perform a few administrative tasks, including setting up and maintaining your product list on the Google Play Developer Console, registering test accounts, and handling refunds when necessary.

You must have a Google Play publisher account to register test accounts. And you must have a Google Wallet merchant account to create a product list and issue refunds to your users. If you already have a publisher account on Google Play, you can use your existing account. You do not need to register for a new account to support in-app billing.

If you do not have a publisher account, you can register as a Google Play developer and set up a publisher account at the Google Play Developer Console. If you do not have a Google Wallet merchant account, you can register for one through the Developer Console.

Creating a Product List

The Google Play Developer Console provides a product list for each of your published applications. You can sell an item using Google Play's in-app billing feature only if the item is listed on an application's product list. Each application has its own product list; you cannot sell items that are listed in another application's product list.

You can access an application's product list by clicking the In-App Products link in applications listed in your developer account (see figure 1). The In-App Products link appears only if you have a Google Wallet merchant account and the application's manifest includes the com.android.vending.BILLING permission.

A product list specifies items you are selling in an application — in-app products, subscriptions, or a combination of both. For each item, the product list contains information such as a product id, product description, and price. The product list stores only metadata about the items you are selling in your application. It does not store any digital content. You are responsible for storing and delivering the digital content that you sell in your applications.

Figure 1. You can access an application's product list by clicking the In-App Products link in the main Apps navigation.

You can create a product list for any published application, or any application in the alpha or beta channels, that's been uploaded and saved to the Developer Console. However, you must have a Google Wallet merchant account and the application's manifest must include the com.android.vending.BILLING permission. If an application's manifest does not include this permission, you will be able to edit existing items in the product list but you will not be able to add new items to the list. For more information about this permission, see Updating Your Application's Manifest.

Note: Previously you could test an app by uploading an unpublished "draft" version. This functionality is no longer supported; instead, you must publish it to the alpha or beta distribution channel. For more information, see Draft Apps are No Longer Supported.

In addition, an application package can have only one product list. If you create a product list for an application, and you use the multiple APK feature to distribute more than one APK for that application, the product list applies to all APK versions that are associated with the application listing. You cannot create individual product lists for each APK if you are using the multiple APK feature.

You can add items to a product list two ways: you can add items one at a time by using the In-app Products UI (see figure 2), or you can add a batch of items by importing the items from a comma-separated values (CSV) file. Adding items one at a time is useful if your application has only a few in-app items or you are adding only a few items to a product list for testing purposes. The CSV file method is useful if your application has a large number of in-app items.

Note: Batch upload of product lists containing subscriptions is not yet supported.

Adding items one at a time to a product list

To add an item to a product list using the In-app Products UI, follow these steps:

  1. Log in to your publisher account.
  2. In the All Applications panel, click on the app name, then select In-app Products.
  3. Click Add new product (see figure 2) and provide details about the item you are selling and then click Save or Publish.

Figure 2. The Add New Product page lets you add items to an application's product list.

You must enter the following information for each item in a product list:

Figure 3. Specifying additional currencies for an in-app product.

For more information about product IDs and product lists, see Creating In-App Product IDs. For more information about pricing, see In-App Billing Pricing.

Note: Be sure to plan your product ID namespace. You cannot reuse or modify product IDs after you save them.

Adding a batch of items to a product list

To add a batch of items to a product list using a CSV file, you first need to create your CSV file. The data values that you specify in the CSV file represent the same data values you specify manually through the In-app Products UI (see Adding items one at a time to a product list).

If you are importing and exporting CSV files with in-app products, please keep tax-inclusive pricing in mind. If you use auto-fill, you can provide a tax-exclusive default price and tax-inclusive prices will be auto-filled. If you do not use auto-fill, prices you provide must include tax.

Note: Batch upload of product lists containing subscriptions is not yet supported.

The CSV file uses commas (,) and semi-colons (;) to separate data values. Commas are used to separate primary data values, and semi-colons are used to separate subvalues. For example, the syntax for the CSV file is as follows:

"product_id","publish_state","purchase_type","autotranslate ","locale; title; description","autofill","country; price"

Descriptions and usage details are provided below.

Table 1. Language codes you can use with the locale field.

Language Code Language Code
Chinese zh_TW Italian it_IT
Czech cs_CZ Japanese ja_JP
Danish da_DK Korean ko_KR
Dutch nl_NL Norwegian no_NO
English en_US Polish pl_PL
French fr_FR Portuguese pt_PT
Finnish fi_FI Russian ru_RU
German de_DE Spanish es_ES
Hebrew iw_IL Swedish sv_SE
Hindi hi_IN -- --

To import the items that are specified in your CSV file, do the following:

  1. Log in to your publisher account.
  2. In the All Applications panel, click on the app name, then select In-app Products.
  3. On the In-app Products List page, click Import/Export > Import in-app products from CSV file, then select your CSV file.

    The CSV file must be on your local computer or on a local disk that is connected to your computer.

  4. Select the Overwrite checkbox if you want to overwrite existing items in your product list.

    This option overwrites values of existing items only if the value of the product_id in the CSV file matches the In-app Product ID for an existing item in the product list. Overwriting does not delete items that are on a product list but not present in the CSV file.

You can also export an existing product list to a CSV file by clicking Export to CSV on the In-app Product List page. This is useful if you have manually added items to a product list and you want to start managing the product list through a CSV file.

Choosing a Product Type

An item's product type controls how Google Play manages the purchase of the item. There are several product types, including "managed per user account", "unmanaged," and "subscription." However, note that the product types supported vary across In-app Billing Version, so you should always choose a product type that's valid for the version of In-app BIlling that your app uses.

For details, refer to the documentation for In-app Billing Version 3 or In-app Billing Version 2.

Handling Refunds

In-app billing does not allow users to send a refund request to Google Play. Refunds for in-app purchases must be directed to you (the application developer). You can then process the refund through your Google Wallet merchant account. When you do this, Google Play receives a refund notification from Google Wallet, and Google Play sends a refund message to your application. For more information, see Handling IN_APP_NOTIFY messages and In-app Billing Pricing.

Important: You cannot use the Google Wallet API to issue refunds or cancel In-app Billing transactions. You must do this manually through your Google Wallet merchant account. However, you can use the Google Wallet API to retrieve order information.

Working with Order Numbers

When a user purchases an in-app item, Google Wallet assigns the transaction a unique and permanent order number. Google Play provides that order number to you at the conclusion of the purchase flow, as the value of the orderId field of the PURCHASE_STATE_CHANGED intent.

In your app, you can use the order number as a general-purpose identifier for the in-app purchase transaction. After the purchase, you can use the order number as a means of tracking the transaction in reconciliation reports and for customer support.

The order number itself is a string consisting of numbers only, with a format assigned and managed by Google Wallet.

For transactions dated 5 December 2012 or later, Google Wallet assigns a Merchant Order Number (rather than a Google Order Number) and reports the Merchant Order Number as the value of orderID. Here's an example:

"orderId" : "12999556515565155651.5565135565155651"

For transactions dated previous to 5 December 2012, Google checkout assigned a Google Order Number and reported that number as the value of orderID. Here's an example of an orderID holding a Google Order Number:

"orderId" : "556515565155651"

Setting Up Test Accounts

The Google Play Developer Console lets you set up one or more test accounts. A test account is a regular Google account that you register on the Developer Console as a test account. Test accounts are authorized to make in-app purchases from applications that you have uploaded to the Google Play Developer Console but have not yet published.

You can use any Google account as a test account. Test accounts are useful if you want to let multiple people test In-app Billing on applications without giving them access to your publisher account's sign-in credentials. If you want to own and control the test accounts, you can create the accounts yourself and distribute the credentials to your developers or testers.

Test accounts have three limitations:

To add test accounts to your publisher account, follow these steps:

  1. Log in to your publisher account.
  2. Click the Settings icon.
  3. Locate the License Testing panel.
  4. Add the email addresses for the test accounts you want to register, separating each account with a comma.
  5. Click Save to save your profile changes.

Getting an app's license key

The Google Play Developer Console provides a public licensing key for each app. To get the key for an app, follow these steps:

  1. Open the All Applications panel.
  2. Click on the app name, then select Services & APIs.
  3. Scroll down to the Your License Key for this Application field to locate the key for the app, as shown in the figure below.

Previously, the Developer Console provided a single public key per developer account. To transition apps to the new per-app public key, the Developer Console set the app-specific key as the former developer key. This ensures compatibility for apps that depend on the (former) developer key.

Figure 4. You can find the license key for each app in the Services & APIs panel.

Where to Get Support

If you have questions or encounter problems while implementing In-app Billing, contact the support resources listed in the following table (see table 2). By directing your queries to the correct forum, you can get the support you need more quickly.

Table 2. Developer support resources for Google Play In-app Billing.

Support Type Resource Range of Topics
Development and testing issues Google Groups: android-developers In-app billing integration questions, user experience ideas, handling of responses, obfuscating code, IPC, test environment setup.
Stack Overflow: http://stackoverflow.com/questions/tagged/ android
Billing issue tracker Billing project issue tracker Bug and issue reports related specifically to In-app Billing sample code.

For general information about how to post to the groups listed above, see Developer Forums document in the Resources tab.