page.title=In-app Billing Overview parent.title=In-app Billing parent.link=index.html @jd:body
This documentation describes the fundamental In-app Billing components and features that you need to understand in order to add In-app Billing features into your application.
Your application accesses the In-app Billing service using an API that is exposed by the Google Play app that is installed on the device. The Google Play app then conveys billing requests and responses between your application and the Google Play server. In practice, your application never directly communicates with the Google Play server. Instead, your application sends billing requests to the Google Play application over interprocess communication (IPC) and receives responses from the Google Play app. Your application does not manage any network connections between itself and the Google Play server.
In-app Billing can be implemented only in applications that you publish through Google Play. To complete in-app purchase requests, the Google Play app must be able to access the Google Play server over the network.
Currently, Google Play supports two versions of the In-app Billing API. To determine which version you should use, see Migration Considerations.
Both versions offer very broad compatibility across the range of Android devices. In-app Billing Version 3 is supported on devices running Android 2.2 or higher that have the latest version of the Google Play store installed (over 90% of active devices). Version 2 offers similar compatibility. See Version Notes for more details.
In-app products are the digital goods that you offer for sale from inside your application to users. Examples of digital goods includes in-game currency, application feature upgrades that enhance the user experience, and new content for your application.
You can use In-app Billing to sell only digital content. You cannot use In-app Billing to sell physical goods, personal services, or anything that requires physical delivery. Unlike with priced applications, once the user has purchased an in-app product there is no refund window.
Google Play does not provide any form of content delivery. You are responsible for delivering the digital content that you sell in your applications. In-app products are always explicitly associated with one and only one app. That is, one application cannot purchase an in-app product published for another app, even if they are from the same developer.
In-app Billing supports different product types to give you flexibility in how you monetize your application. In all cases, you define your products using the Google Play Developer Console.
You can specify these types of products for your In-app Billing application — managed in-app products, subscriptions, and unmanaged in-app products. The term “managed” indicates that Google Play handles and tracks ownership for in-app products on your application on a per user account basis, while “unmanaged” indicates that you will manage the ownership information yourself.
To learn more about the product types supported by the different API versions, see the related documentation for Version 2 and Version 3.
The Developer Console is where you can publish your In-app Billing application, and manage the various in-app products that are available for purchase from your application.
You can create a product list of digital goods that are associated with your application, including items for one-time purchase and recurring subscriptions. For each item, you can define information such as the item’s unique product ID (also called its SKU), product type, pricing, description, and how Google Play should handle and track purchases for that product.
You can also create test accounts to authorize access for testing applications that are unpublished.
To learn how to use the Developer Console to configure your in-app products and product list, see Administering In-app Billing.
Google Play uses the same checkout backend service as is used for application purchases, so your users experience a consistent and familiar purchase flow.
Important: You must have a Google Checkout Merchant account to use the In-app Billing service on Google Play.
To initiate a purchase, your application sends a billing request for a specific in-app product. Google Play then handles all of the checkout details for the transaction, including requesting and validating the form of payment and processing the financial transaction.
When the checkout process is complete, Google Play sends your application the purchase details, such as the order number, the order date and time, and the price paid. At no point does your application have to handle any financial transactions; that role is provided by Google Play.
Figure 1. Applications initiate In-app Billing requests through their own UI (first screen). Google Play responds to the request by providing the checkout user interface (middle screen). When checkout is complete, the application resumes.
To help you integrate In-app Billing into your application, the Android SDK provides two sample applications that demonstrate how to sell in-app products from inside an app.
Important: It's strongly recommended that you obfuscate the code in your application before you publish it. For more information, see Security and Design.
The following considerations may be applicable if you are planning to create a new in-app biling application, or migrate your existing In-app Billing implementation from the Version 2 or earlier API to the Version 3 API.
Google Play will continue to support both the Version 2 and Version 3 APIs for some time, so you can plan to migrate to Version 3 at your own pace. The Google Play team will give advance notice of any upcoming changes to the support status of In-app Billing Version 2.
You can use the following table to decide which version of the API to use, depending on the needs of your application.
Table 1. Selecting the In-app Billing API Version for Your Project
Choose Version 3 if ... | Choose Version 2 if ... |
---|---|
|
|
If you have published apps selling in-app products, note that: