1page.title=In-app Billing Overview 2parent.title=In-app Billing 3parent.link=index.html 4@jd:body 5 6<div id="qv-wrapper"> 7<div id="qv"> 8 <h2>Quickview</h2> 9 <ul> 10 <li>Use In-app Billing to sell digital goods, including one-time items and 11recurring subscriptions.</li> 12 <li>Supported for any app published on Google Play. You only need a Google 13Play Developer Console account and a Google payments merchant account.</li> 14 <li>Checkout processing is automatically handled by Google Play, with the 15same look-and-feel as for app purchases.</li> 16 </ul> 17 <h2>In this document</h2> 18 <ol> 19 <li><a href="#api">In-app Billing API</a></li> 20 <li><a href="#products">In-app Products</a> 21 <ol> 22 <li><a href="#prodtypes">Product Types</a> 23 </ol> 24 </li> 25 <li><a href="#console">Google Play Developer Console</a></li> 26 <li><a href="#checkout">Google Play Purchase Flow</a></li> 27 <li><a href="#samples">Sample App</a></li> 28 <li><a href="#migration">Migration Considerations</a></li> 29 </ol> 30 <h2>Related Samples</h2> 31 <ol> 32 <li><a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">Sample 33 Application (V3)</a></li> 34 </ol> 35 <h2>Related Videos</h2> 36 <ol> 37 <li><a href="https://www.youtube.com/watch?v=UvCl5Xx7Z5o">Implementing 38 Freemium</a></li> 39 </ol> 40</div> 41</div> 42 43<p>This documentation describes the fundamental In-app Billing components and 44features that you need to understand in order to add In-app 45Billing features into your application.</p> 46 47<p class="note"><b>Note</b>: Ensure that you comply with applicable laws in the countries where you 48distribute apps. For example, in EU countries, laws based on the 49<a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2005:149:0022:0039:EN:PDF"> 50Unfair Commercial Practices Directive</a> prohibit direct exhortations to children to buy advertised 51products or to persuade their parents or other adults to buy advertised products for them. 52See the 53<a href="http://ec.europa.eu/consumers/enforcement/docs/common_position_on_online_games_en.pdf"> 54position of the EU consumer protection authorities</a> for more information on this and other 55topics. 56</p> 57 58<h2 id="api">In-app Billing API</h2> 59<p>Your application accesses the In-app Billing service using an API that is 60exposed by the Google Play app that is installed on the device. The Google Play 61app then conveys billing requests and responses between your 62application and the Google Play server. In practice, your application never 63directly communicates with the Google Play server. Instead, your application 64sends billing requests to the Google Play application over interprocess 65communication (IPC) and receives responses from the Google Play app. 66Your application does not manage any network connections between itself and 67the Google Play server.</p> 68<p>In-app Billing can be implemented only in applications that you publish 69through Google Play. To complete in-app purchase requests, the Google Play app 70must be able to access the Google Play server over the network.</p> 71 72<p>In-app billing Version 3 is the latest version, and maintains very broad 73compatibility across the range of Android devices. In-app Billing Version 3 is 74supported on devices running Android 2.2 or higher that have the latest version 75of the Google Play store installed (<a 76href="{@docRoot}about/dashboards/index.html">a vast majority</a> of active 77devices).</p> 78 79<h4>Version 3 features</h4> 80<ul> 81<li>Requests are sent through a streamlined API that allows you to easily request 82product details from Google Play, order in-app products, and quickly restore 83items based on users' product ownership</li> 84<li>Order information is synchronously propagated to the device on purchase 85completion</li> 86<li>All purchases are “managed” (that is, Google Play keeps track of the user's 87ownership of in-app products). The user cannot own multiple copies of an in-app 88item; only one copy can be owned at any point in time</li> 89<li>Purchased items can be consumed. When consumed, the item reverts to the 90"unowned" state and can be purchased again from Google Play</li> 91<li>Provides support for <a 92 href="{@docRoot}google/play/billing/billing_subscriptions.html">subscriptions</a></li> 93</ul> 94<p>For details about other versions of In-app Billing, see the 95<a href="{@docRoot}google/play/billing/versions.html">Version Notes</a>.</p> 96 97<h2 id="products">In-app Products</h2> 98<p>In-app products are the digital goods that you offer for sale from inside your 99application to users. Examples of digital goods includes in-game currency, 100application feature upgrades that enhance the user experience, and new content 101for your application.</p> 102<p>You can use In-app Billing to sell only digital content. 103You cannot use In-app Billing to sell physical goods, personal services, or 104anything that requires physical delivery. Unlike with priced applications, once 105the user has purchased an in-app product there is no refund window.</p> 106<p>Google Play does not provide any form of content delivery. You are 107responsible for delivering the digital content that you sell in your 108applications. In-app products are always explicitly associated with one and 109only one app. That is, one application cannot purchase an in-app product 110published for another app, even if they are from the same developer.</p> 111 112<h3 id="prodtypes">Product types</h3> 113<p>In-app Billing supports different product types to give you flexibility in 114how you monetize your application. In all cases, you define your products using 115the Google Play Developer Console.</p> 116<p>You can specify these types of products for your In-app Billing application 117— <em>managed in-app products</em> and <em>subscriptions</em>. Google Play 118handles and tracks ownership for in-app products and subscriptions on your 119application on a per user account basis. 120<a href="{@docRoot}google/play/billing/api.html#producttypes">Learn more about 121the product types supported by In-app Billing Version 3</a>.</p> 122 123<h2 id="console">Google Play Developer Console</h2> 124<p>The Developer Console is where you can publish your 125In-app Billing application and manage the various in-app products that are 126available for purchase from your application.</p> 127<p>You can create a product list of 128digital goods that are associated with your application, including items for 129one-time purchase and recurring subscriptions. For each item, you can define 130information such as the item’s unique product ID (also called its SKU), product 131type, pricing, description, and how Google Play should handle and track 132purchases for that product.</p> 133<p>If you sell several of your apps or in-app products at the same price, you 134can add <em>pricing templates</em> to manage these price points from a 135centralized location. When using pricing templates, you can include local taxes 136within the prices you provide, or you can provide prices and have the system 137add local taxes to these prices. You can make changes to the prices in your 138pricing templates, such as refreshing the exchange rates for certain 139countries, and your changes are applied to the apps and in-app products 140that you link to the template.</p> 141<p>You can also create test accounts to authorize 142access for testing applications that are unpublished.</p> 143<p>To learn how to use the Developer Console to configure your in-app 144products and product list, see 145<a href="{@docRoot}google/play/billing/billing_admin.html">Administering 146In-app Billing</a>.</p> 147 148<h2 id="checkout">Google Play Purchase Flow</h2> 149<p>Google Play uses the same checkout backend service as is used for application 150purchases, so your users experience a consistent and familiar purchase flow.</p> 151<p class="note"><strong>Important:</strong> You must have a Google payments 152merchant account to use the In-app Billing service on Google Play.</p> 153<p>To initiate a purchase, your application sends a billing request for a 154specific in-app product. Google Play then handles all of the checkout details for 155the transaction, including requesting and validating the form of payment and 156processing the financial transaction.</p> 157<p>When the checkout process is complete, 158Google Play sends your application the purchase details, such as the order 159number, the order date and time, and the price paid. At no point does your 160application have to handle any financial transactions; that role is provided by 161Google Play.</p> 162 163<h2 id="samples">Sample Application</h2> 164<p>To help you integrate In-app Billing into your application, the Android SDK 165provides a sample application that demonstrates how to sell in-app products and subscriptions 166from inside an app.</p> 167 168<p>The <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample"> 169TrivialDrive sample for the Version 3 API</a> sample shows how to use the In-app 170Billing Version 3 API 171to implement in-app product and subscription purchases for a driving game. The 172application demonstrates how to send In-app Billing requests, and handle 173synchronous responses from Google Play. The application also shows how to record 174item consumption with the API. The Version 3 sample includes convenience classes 175for processing In-app Billing operations as well as perform automatic signature 176verification.</p> 177 178<p class="caution"><strong>Recommendation</strong>: Make sure to obfuscate the 179code in your application before you publish it. For more information, see 180<a href="{@docRoot}google/play/billing/billing_best_practices.html">Security 181and Design</a>.</p> 182 183<h2 id="migration">Migration Considerations</h2> 184<p>The In-app Billing Version 2 API was discontinued in January 2015. 185If you have an existing In-app Billing implementation that uses API Version 2 or 186earlier, you must migrate to <a href="{@docRoot}google/play/billing/api.html">In-app Billing Version 1873</a>.</p> 188 189<p>If you have published apps selling in-app products, note that:</p> 190<ul> 191<li>Managed items and subscriptions that you have previously defined in the Developer Console will 192work with Version 3 as before.</li> 193<li>Unmanaged items that you have defined for existing applications will be 194treated as managed products if you make a purchase request for these items using 195the Version 3 API. You do not need to create a new product entry in Developer 196Console for these items, and you can use the same product IDs to purchase these 197items. 198</ul> 199