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