| page.title=In-app Billing Overview |
| parent.title=In-app Billing |
| parent.link=index.html |
| @jd:body |
| |
| <div id="qv-wrapper"> |
| <div id="qv"> |
| <h2>Quickview</h2> |
| <ul> |
| <li>Use In-app Billing to sell digital products, including one-time products and |
| recurring subscriptions.</li> |
| <li>In-app Billing is supported for any app published on Google Play. You need only a |
| Google |
| Play Developer Console account and a Google payments merchant account.</li> |
| <li>Google Play automatically handles checkout processing with the |
| same look and feel as app purchases.</li> |
| </ul> |
| <h2>In this document</h2> |
| <ol> |
| <li><a href="#api">In-app Billing API</a></li> |
| <li><a href="#products">In-app Products</a> |
| <ol> |
| <li><a href="#prodtypes">Product types</a> |
| </ol> |
| </li> |
| <li><a href="#console">Google Play Developer Console</a></li> |
| <li><a href="#checkout">Google Play Purchase Flow</a></li> |
| <li><a href="#samples">Sample App</a></li> |
| <li><a href="#migration">Migration Considerations</a></li> |
| </ol> |
| <h2>Related samples</h2> |
| <ol> |
| <li><a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">Sample |
| Application (V3)</a></li> |
| </ol> |
| <h2>Related videos</h2> |
| <ol> |
| <li><a class="external-link" href="https://www.youtube.com/watch?v=UvCl5Xx7Z5o"> |
| Implementing |
| Freemium</a></li> |
| </ol> |
| </div> |
| </div> |
| |
| <p>This document 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.</p> |
| |
| <p class="note"><b>Note</b>: Ensure that you comply with applicable laws in the countries where |
| you distribute apps. For example, in EU countries, laws based on the |
| <a class="external-link" |
| href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2005:149:0022:0039:EN:PDF"> |
| Unfair Commercial Practices Directive</a> prohibit direct exhortations to children to buy |
| advertised products or to persuade their parents or other adults to buy advertised products |
| for them. See the |
| <a class="external-link" |
| href="http://ec.europa.eu/consumers/enforcement/docs/common_position_on_online_games_en.pdf"> |
| position of the EU consumer protection authorities</a> for more information on this and other |
| topics. |
| </p> |
| |
| <h2 id="api">In-app Billing API</h2> |
| <p>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 app 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.</p> |
| <p>You can implement In-app Billing 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.</p> |
| |
| <p>In-app Billing Version 3 is the latest version, and it maintains very broad |
| compatibility across the range of Android devices. In-app Billing Version 3 is |
| supported on devices running Android 2.2 (API level 8) or higher that have the latest version |
| of the Google Play app installed (<a |
| href="{@docRoot}about/dashboards/index.html">a vast majority</a> of active |
| devices).</p> |
| |
| <h4>Version 3 features</h4> |
| <p>In-app Billing Version 3 provides the following features:</p> |
| <ul> |
| <li>Your app sends requests through a streamlined API that allows users to easily request |
| product details from Google Play and order in-app products. The API quickly restores |
| products based on the user's ownership.</li> |
| <li>The API synchronously propagates order information to the device on purchase |
| completion.</li> |
| <li>All purchases are <em>managed</em> (that is, Google Play keeps track of the user's |
| ownership of in-app products). The user can't own multiple copies of an in-app |
| product; only one copy can be owned at any point in time.</li> |
| <li>Purchased products can be consumed. When consumed, the product reverts to the |
| <em>unowned</em> state and can be purchased again from Google Play.</li> |
| <li>The API provides support for <a |
| href="{@docRoot}google/play/billing/billing_subscriptions.html">subscriptions</a>.</li> |
| </ul> |
| <p>For details about other versions of In-app Billing, see the |
| <a href="{@docRoot}google/play/billing/versions.html">Version Notes</a>.</p> |
| |
| <h2 id="products">In-app Products</h2> |
| <p>In-app products are the digital products that you offer for sale to users from inside your |
| application. Examples of digital products include in-game currency, |
| application feature upgrades that enhance the user experience, and new content |
| for your application.</p> |
| <p>You can use In-app Billing to sell only digital content. |
| You can't use In-app Billing to sell physical products, personal services, or |
| anything that requires physical delivery. Unlike with priced applications, there is no refund |
| window after |
| the user has purchased an in-app product.</p> |
| <p>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 |
| only one app. That is, one application can't purchase an in-app product |
| that is published for another app, even if they are from the same developer.</p> |
| |
| <h3 id="prodtypes">Product types</h3> |
| <p>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.</p> |
| <p>You can specify two product types for your In-app Billing application: |
| <em>managed in-app products</em> and <em>subscriptions</em>. Google Play |
| handles and tracks ownership for in-app products and subscriptions for your |
| application on a per-user basis. |
| <a href="{@docRoot}google/play/billing/api.html#producttypes">Learn more</a> about |
| the product types supported by In-app Billing Version 3.</p> |
| |
| <h2 id="console">Google Play Developer Console</h2> |
| <p>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.</p> |
| <p>You can create a product list of |
| digital products that are associated with your application, including products for |
| one-time purchase and recurring subscriptions. You can define |
| information for each product such as the following:</p> |
| <ul> |
| <li>Unique product ID (also called its SKU).</li> |
| <li>Product type.</li> |
| <li>Pricing.</li> |
| <li>Description.</li> |
| <li>Google Play handling and tracking of purchases for that product.</li></p> |
| </ul> |
| <p>If you sell several of your apps or in-app products at the same price, you |
| can add <em>pricing templates</em> to manage these price points from a |
| centralized location. When using pricing templates, you can include local taxes |
| within the prices you provide, or you can provide prices and have the system |
| add local taxes to these prices. You can make changes to the prices in your |
| pricing templates, such as refreshing the exchange rates for certain |
| countries, and your changes are applied to the apps and in-app products |
| that you link to the template.</p> |
| <p>You can also create test accounts to authorize |
| access for testing applications that are unpublished.</p> |
| <p>To learn how to use the Developer Console to configure your in-app |
| products and product list, see |
| <a href="{@docRoot}google/play/billing/billing_admin.html">Administering |
| In-app Billing</a>.</p> |
| |
| <h2 id="checkout">Google Play Purchase Flow</h2> |
| <p>Google Play uses the same backend checkout service that is used for application |
| purchases, so your users experience a consistent and familiar purchase flow.</p> |
| <p class="note"><strong>Important:</strong> You must have a Google payments |
| merchant account to use the In-app Billing service on Google Play.</p> |
| <p>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.</p> |
| <p>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 belongs to |
| Google Play.</p> |
| |
| <h2 id="samples">Sample Application</h2> |
| <p>To help you integrate In-app Billing into your application, the Android SDK |
| provides a sample application that demonstrates how to sell in-app products and subscriptions |
| from inside an app.</p> |
| |
| <p>The <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample"> |
| TrivialDrive for the Version 3 API</a> sample shows how to use the In-app |
| Billing Version 3 API |
| to implement in-app product and subscription purchases for a driving game. The |
| application demonstrates how to send In-app Billing requests and handle |
| synchronous responses from Google Play. The application also shows how to record |
| product consumption with the API. The Version 3 sample includes convenience classes |
| for processing In-app Billing operations as well as perform automatic signature |
| verification.</p> |
| |
| <p class="caution"><strong>Recommendation</strong>: Be sure to obfuscate the |
| code in your application before you publish it. For more information, see |
| <a href="{@docRoot}google/play/billing/billing_best_practices.html">Security |
| and Design</a>.</p> |
| |
| <h2 id="migration">Migration Considerations</h2> |
| <p>The In-app Billing Version 2 API was discontinued in January 2015. |
| If you have an existing In-app Billing implementation that uses API Version 2 or |
| earlier, you must migrate to <a href="{@docRoot}google/play/billing/api.html"> |
| In-app Billing Version 3</a>.</p> |
| |
| <p>After migration, managed and unmanaged products are handled as follows:</p> |
| <ul> |
| <li>Managed products and subscriptions that you have previously defined in the |
| Developer Console |
| work with Version 3 just as before.</li> |
| <li>Unmanaged products that you have defined for existing applications are |
| treated as managed products if you make a purchase request for these products using |
| the Version 3 API. You don't need to create a new product entry in the Developer |
| Console for these products, and you can use the same product IDs to manage these |
| products. |
| </ul> |