In-app Billing Overview

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.

In-app Billing API


Your application accesses the In-app Billing service using an API that is exposed by the Bazaar app that is installed on the device. The Bazaar app then conveys billing requests and responses between your application and the Bazaar server. In practice, your application never directly communicates with the Bazaar server. Instead, your application sends billing requests to the Bazaar application over interprocess communication (IPC) and receives responses from the Bazaar app. Your application does not manage any network connections between itself and the Bazaar server.

In-app Billing can be implemented only in applications that you publish through Bazaar. To complete in-app purchase requests, the Bazaar app must be able to access the Bazaar server over the network.

  • Requests are sent through a streamlined API that allows you to easily request product details from Bazaar, order in-app products, and quickly restore items based on users' product ownership
  • Order information is synchronously propagated to the device on purchase completion
  • All purchases are “managed” (that is, Bazaar keeps track of the user's ownership of in-app products). The user cannot own multiple copies of an in-app item; only one copy can be owned at any point in time
  • Purchased items can be consumed. When consumed, the item reverts to the "unowned" state and can be purchased again from Bazaar

version 3 offers 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 Bazaar store installed (over 90% of active devices).

In-app Products


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.

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

Product types

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 Bazaar Payment Panel.

You can specify these types of products for your In-app Billing application. The term “managed” indicates that Bazaar handles and tracks ownership for in-app products on your application on a per user account basis

Bazaar Payment Panel


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 Bazaar should handle and track purchases for that product.

To learn how to use the Developer Console to configure your in-app products and product list, see Administering In-app Billing.

Bazaar Purchase Flow


Bazaar 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 Bazaar Account to use the In-app Billing service on Bazaar.

To initiate a purchase, your application sends a billing request for a specific in-app product. Bazaar 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, Bazaar 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 Bazaar.

iab_v3_checkout_flow

Figure 1. Applications initiate In-app Billing requests through their own UI (first screen). Bazaar responds to the request by providing the checkout user interface (middle screen). When checkout is complete, the application resumes.

Sample Applications


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.

TrivialDrive sample for the Version 3 API
This sample shows how to use the In-app Billing Version 3 API to implement in-app product purchases for a driving game. The application demonstrates how to send In-app Billing requests, and handle synchronous responses from Bazaar. The application also shows how to record item consumption with the API. The Version 3 sample includes convenience classes for processing In-app Billing operations as well as perform automatic signature verification.

Important: It's strongly recommended that you obfuscate the code in your application before you publish it. For more information, see Security and Design.