- Home Startseite ホーム 主页 首頁
- SDK
- Dev Guide Handbuch Guía Guide Guida 開発ガイド 开发人员指南 開發指南
- Reference Referenz Referencia Référence Riferimento リファレンス 参考 參考資料
- Resources
- Videos ビデオ
- Blog ブログ 博客 網誌

Android.com

In-app Billing >

# Administering In-app Billing

## In this document

1. Creating a Product List
2. Choosing a Purchase Type
3. Setting up Test Accounts
4. Handling Refunds
5. Where to Get Support

## Downloads

1. Sample Application

## See also

1. Overview of In-app Billing
2. Implementing In-app Billing
3. Security and Design
4. Testing In-app Billing
5. In-app Billing Reference

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 publisher site, registering test accounts, and handling refunds when necessary.

You must have an Android Market publisher account to register test accounts. And you must have a Google Checkout Merchant account to create a product list and issue refunds to your users. If you already have a publisher account on Android Market, 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 an Android Market developer and set up a publisher account at the Android Market publisher site. If you do not have a Google Checkout Merchant account, you can register for one at the Google Checkout site.

## Creating a Product List

The Android Market publisher site provides a product list for each of your published applications. You can sell an item using Android Market'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 that appears under each of the applications that are listed for your publisher account (see figure 1). The In-App Products link appears only if you have a Google Checkout Merchant account and an application's manifest includes the `com.android.vending.BILLING` permission.

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

A product list contains information about the items you are selling, such as a product id, product description, and price (see figure 2). 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 2. An application's product list.

You can create a product list for a published application or a draft application that's been uploaded and saved to the Android Market site. However, you must have a Google Checkout 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, see Modifying your application's AndroidManifest.xml file.

To create a product list for an application, follow these steps:

1. Log in to your publisher account.
2. In the All Android Market listings panel, under the application name, click In-app Products.
3. On the In-app Products List page, click Add in-app product.
4. On the Create New In-app Product page (see figure 3), provide details about the item you are selling and then click Save.

Figure 3. The Create New In-app 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:

- In-app Product ID

  Product IDs are unique across an application's namespace. A product ID must start with a lowercase letter or a number, and must be composed using only lowercase letters (a-z), numbers (0-9), underlines (_), and dots (.). The product ID "android.test" is reserved, as are all product IDs that start with "android.test."

  In addition, you cannot modify an item's product ID after it is created, and you cannot reuse a product ID, even if you delete the item previously using the product ID.

- Purchase type

  The purchase type can be "managed per user account" or "unmanaged." You can specify an item's purchase type only through the publisher site and you can never change an item's purchase type once you specify it. For more information, see Choosing a purchase type later in this document.

- Publishing State

  An item's publishing state can be "published" or "unpublished." However, to be visible to a user during checkout, an item's publishing state must be set to "published" and the item's application must be published on Android Market.

  Note: This is not true for test accounts. An item is visible to a test account if the application is not published and the item is published. See Testing In-app Billing for more information.

- Language

  A product list inherits its language from the parent application.

- Title

  The title is a short descriptor for the item. For example, "Sleeping potion." Titles must be unique across an application's namespace. Every item must have a title. The title is visible to users during checkout. For optimum appearance, titles should be no longer than 25 characters; however, titles can be up to 55 characters in length.

- Description

  The description is a long descriptor for the item. For example, "Instantly puts creatures to sleep. Does not work on angry elves." Every item must have a description. The description is visible to users during checkout. Descriptions can be up to 80 characters in length.

- Price

  Every item must have a price greater than zero; you cannot set a price of "0" (free).

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.

### Choosing a Purchase Type

An item's purchase type controls how Android Market manages the purchase of the item. There are two purchase types: "managed per user account" and "unmanaged."

Items that are managed per user account can be purchased only once per user account. When an item is managed per user account, Android Market permanently stores the transaction information for each item on a per-user basis. This enables you to query Android Market with the `RESTORE_TRANSACTIONS` request and restore the state of the items a specific user has purchased.

If a user attempts to purchase a managed item that has already been purchased, Android Market displays an "Item already purchased" error. This occurs during checkout, when Android Market displays the price and description information on the checkout page. When the user dismisses the error message, the checkout page disappears and the user returns to your user interface. As a best practice, your application should prevent the user from seeing this error. The sample application demonstrates how you can do this by keeping track of items that are managed and already purchased and not allowing users to select those items from the list. Your application should do something similar—either graying out the item or hiding it so that it cannot be selected.

The "manage by user account" purchase type is useful if you are selling items such as game levels or application features. These items are not transient and usually need to be restored whenever a user reinstalls your application, wipes the data on their device, or installs your application on a new device.

Items that are unmanaged do not have their transaction information stored on Android Market, which means you cannot query Android Market to retrieve transaction information for items whose purchase type is listed as unmanaged. You are responsible for managing the transaction information of unmanaged items. Also, unmanaged items can be purchased multiple times as far as Android Market is concerned, so it's also up to you to control how many times an unmanaged item can be purchased.

The "unmanaged" purchase type is useful if you are selling consumable items, such as fuel or magic spells. These items are consumed within your application and are usually purchased multiple times.

## Handling Refunds

In-app billing does not allow users to send a refund request to Android Market. Refunds for in-app purchases must be directed to you (the application developer). You can then process the refund through your Google Checkout Merchant account. When you do this, Android Market receives a refund notification from Google Checkout, and Android Market 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 Checkout API to issue refunds or cancel in-app billing transactions. You must do this manually through your Google Checkout merchant account. However, you can use the Google Checkout API to retrieve order information.

## Setting Up Test Accounts

The Android Market publisher site lets you set up one or more test accounts. A test account is a regular Google account that you register on the publisher site as a test account. Test accounts are authorized to make in-app purchases from applications that you have uploaded to the Android Market site 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:

- Test account users can make purchase requests only within applications that are already uploaded to your publisher account (although the application doesn't need to be published).
- Test accounts can only be used to purchase items that are listed (and published) in an application's product list.
- Test account users do not have access to your publisher account and cannot upload applications to your publisher account.

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

1. Log in to your publisher account.
2. On the upper left part of the page, under your name, click Edit profile.
3. On the Edit Profile page, scroll down to the Licensing & In-app Billing panel (see figure 4).
4. In Test Accounts, 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.

Figure 4. The Licensing and In-app Billing panel of your account's Edit Profile page lets you register test accounts.

## 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 Android Market 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
Market billing issue tracker | Market 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.

↑ Go to top

← Back to In-app Billing