1 page.title=Google Play Developer API 2 page.tags="In-app Billing", "Google Play", "inapp billing", "in app billing", "iab", "billing", "publishing" 3 4 5 @jd:body 6 7 <div id="qv-wrapper"> 8 <div id="qv"> 9 <h2>In this document</h2> 10 <!-- TODO: Update TOC --> 11 <ol> 12 <li><a href="#publishing_api_overview">Publishing API</a> 13 <li><a href="#subscriptions_api_overview">Subscriptions and In-App 14 Purchases API</a></li> 15 <li><a href="#using">Using the API</a> 16 <li><a href="#edits">Staged Edits</a></li> 17 <li><a href="#practices">Using the API Efficiently</a> 18 <ol> 19 <li><a href="#quota">Quota</a></li> 20 </ol> 21 </li> 22 </ol> 23 24 <h2>See also</h2> 25 <ol> 26 <li><a href="https://developers.google.com/android-publisher/">Google Play 27 Developer API</a> documentation</li> 28 <li><a href="https://support.google.com/googleplay/android-developer/answer/6071616">Google 29 Help Center</a> overview of the Google Play Developer API</li> 30 </ol> 31 </div> 32 </div> 33 34 <p>The Google Play Developer API is a REST-based web service that allows you to perform publishing 35 and app-management tasks. You can use this API to integrate your publishing 36 operations with your release-management process.</p> 37 38 <p>Not all developers will need to use these APIs—in most cases you will 39 continue to manage your apps directly using the Google Play Developer Console. 40 However, if you have a large number of APKs to manage, or have to track user 41 purchases and subscriptions, you may find this API very useful.</p> 42 43 <p>Using the Google Play Developer API, you can automate a variety of 44 app-management tasks, including:</p> 45 46 <ul> 47 <li>Uploading and releasing new versions of your app</li> 48 <li>Editing your app Google Play Store listings, including localized text and 49 graphics</li> 50 <li>Managing your in-app product catalog, your products purchase status and your 51 app subscriptions</li> 52 </li> 53 </ul> 54 55 56 57 <p>The Google Play Developer API lets you focus on designing and developing your 58 app, while spending less time and effort managing your releases, even as you 59 grow to new markets.</p> 60 61 <p>The Google Play Developer API includes two components:</p> 62 63 <ul> 64 <li>The <a href="#publishing_api_overview">Publishing API</a> lets you upload and publish 65 apps, and perform other publishing-related tasks.</li> 66 <li>The <a href="#subscriptions_api_overview">Subscriptions and In-App Purchases 67 API</a> lets you manage in-app purchases and subscriptions. (This was 68 previously known as the "Purchase Status API".)</li> 69 </ul> 70 71 <h2 id="publishing_api_overview">Publishing API</h2> 72 73 <p> 74 The Google Play Developer Publishing API allows you to automate frequent tasks 75 having to do with app distribution. This provides functions 76 similar to those available to a developer through the Google Play 77 Developer Console, such 78 as: 79 </p> 80 81 <ul><li>Uploading new versions of an app</li> 82 <li>Releasing apps, by assigning APKs to various <em>Tracks</em> (alpha, beta, 83 staged rollout, or production)</li> 84 <li>Creating and modifying Google Play Store listings, including localized text 85 and graphics and multi-device screenshots</li></ul> 86 87 <p>Those tasks are performed using the 88 <a href="#edits">edits</a> 89 functionality, which takes a transactional approach to making changes — 90 you bundle several changes into a single draft edit, then commit the changes all 91 at once. (None of the changes take effect until the edit is committed.)</p> 92 93 <p class="note"><strong>Note:</strong> Not all developers will need to use this 94 API. All the functionality provided by the API is also available through the 95 Google Play 96 Developer Console. However, this API lets you integrate your app and listing 97 update process with your existing tools, which will be very useful for some 98 developers. In particular, if you have a large number of APKs to manage, or 99 localized listings in many different locales, you may find this API invaluable. 100 </p> 101 102 <h2 id="subscriptions_api_overview">Subscriptions and In-App Purchases API</h2> 103 104 <p>The API allows you to manage your app's catalog of in-app products and 105 subscriptions. In addition, with the Subscriptions and In-App Purchases API you 106 can quickly retrieve the 107 details of any purchase using a standard GET request. In the request you supply 108 information about the purchase — app package name, purchase or 109 subscription ID, and the purchase token. The server responds with a JSON object 110 describing the associated purchase details, order status, developer payload, and 111 other information.</p> 112 113 <p>You can use the Purchase Status API in several ways, such as for reporting 114 and reconciliation of individual orders and for verifying purchases and 115 subscription expirations. You can also use the API to learn about cancelled 116 orders and confirm whether in-app products have been consumed, including 117 whether they were consumed before being cancelled.</p> 118 119 <p class="note"><strong>Note:</strong> The Subscriptions and In-App 120 Purchases API does not use the new, transactional "edits" functionality used by 121 the <a href="#publishing_api_overview">Publishing API</a>. Methods for the 122 <a href="https://developers.google.com/android-publisher/api-ref/inappproducts">Inappproducts</a>, 123 <a href="https://developers.google.com/android-publisher/api-ref/purchases/products">Purchases.products</a>, 124 and <a href="https://developers.google.com/android-publisher/api-ref/purchases/subscriptions">Purchases.subscriptions</a> 125 resources take effect immediately. Each resource's API reference page notes 126 specifically whether the methods for that resource use the "edits" 127 model.</p> 128 129 <p>The Purchase Status API is part of the <a 130 href="https://developers.google.com/android-publisher/">Google Play Developer 131 API</a> v. 2.0, available through the Google Developers Console.</p> 132 133 <h2 id="using">Using the API</h2> 134 135 <p>To start making API calls, youll set up and manage the Google Play Developer 136 API directly from the <a href="https://play.google.com/apps/publish/">Google 137 Play Developer Console</a>. The API can only be managed by the owner of your 138 Google Play Developer account.</p> 139 140 <p>To access the API, you'll need to:</p> 141 142 <ol><li>Set up a new or existing API project</li> 143 <li>Set up one or more authorized clients, which can be either: 144 <ul> 145 <li><a href="https://developers.google.com/accounts/docs/OAuth2">OAuth 146 clients</a></li> 147 <li><a href="https://developers.google.com/accounts/docs/OAuth2ServiceAccount"> 148 service account</a></li> 149 </ul></li></ol> 150 151 <p>For full details, see the Google Play Developer API 152 <a href="https://developers.google.com/android-publisher/getting_started">Getting 153 Started</a> page.</p> 154 155 <h2 id="edits">Staged Edits</h2> 156 157 <p>The Google Play Developer Publishing API Edits methods allow you to prepare 158 and commit changes to your Google Play apps. Once your update is ready to go, 159 you can deploy it with a single operation. The changes you can make include:</p> 160 161 <ul> 162 <li>Uploading one or more APKs</li> 163 <li>Assigning different APKs to different tracks: alpha, beta, staged 164 rollout, and production</li> 165 <li>Creating and modifying localized store listings for the app</li> 166 <li>Uploading screenshots and other images for the apps store listings</li> 167 </ul> 168 169 <p>Once all the desired changes have been staged, they are all committed with a 170 single operation.</p> 171 172 <p>For full details on staged edits, see the Google Play Developer API 173 <a href="https://developers.google.com/android-publisher/edits/">Edits</a> 174 page.</p> 175 176 <p class="note"><strong>Note:</strong> The new, transactional "edits" 177 functionality is only used by the <a href="#publishing_api_overview">Publishing 178 API</a>. Methods for the <a href="#subscriptions_api_overview">Subscriptions and 179 In-App Purchases API</a> take effect immediately. Each resource's API reference 180 page notes specifically whether the methods for that resource use the "edits" 181 model.</p> 182 183 <h2 id="practices">Using the API Efficiently</h2> 184 185 <p>Access to the Google Play Developer API is regulated to help ensure a 186 high-performance environment for all applications that use it (as described in 187 <a href="#quota">Quota</a>). While you can 188 request a higher daily quota for your application, we highly recommend that you 189 minimize your access using these techniques: </p> 190 191 <ul> 192 <li><em>Limit the number of app updates</em> — Do not publish alpha or beta 193 updates more frequently than once a day. (Production apps should be updated 194 even less frequently than that.) Every update costs your users time and 195 possibly money. If you update too frequently, users will start ignoring 196 updates, or even uninstall the product. (Of course, if there's a major problem 197 with your app, go ahead and fix it.)</li> 198 <li><em>Query the Purchase Status API for new purchases only</em> — At 199 purchase, your app can pass the purchase token and other details to your backend 200 servers, which can use the Purchase Status API to verify the purchase.</li> 201 <li><em>Cache purchase details on your servers</em> — To the extent possible, 202 cache the purchase details for in-app products and subscriptions on your backend 203 servers. If your app contacts your backend servers at runtime to verify purchase 204 validity, your server can verify the purchase based on the cached details, to 205 minimize use of the Purchase Status API and to provide the fastest possible response 206 (and best experience) for the user.</li> 207 <li><em>Store subscription expiry on your servers</em> — Your servers should 208 use the Purchase Status API to query the expiration date for new subscription tokens, 209 then store the expiration date locally. This allows you to check the status of 210 subscriptions only at or after the expiration (see below).</li> 211 <li><em>Query for subscription status only at expiration</em> — Once your 212 server has retrieved the expiration date of subscription tokens, it should not query 213 the Google Play servers for the subscription status again until the subscription is 214 reaching or has passed the expiration date. Typically, your servers would run a batch 215 query each day to check the status of expiring subscriptions, then update the database. 216 Note that: 217 <ul> 218 <li>Your servers should not query all subscriptions every day.</li> 219 <li>Your servers should never query subscription status dynamically, based on 220 individual requests from your Android application.</li> 221 </ul> 222 </li> 223 </ul> 224 225 <p>By following those general guidelines, your implementation will offer the 226 best possible performance for users.</p> 227 228 <h3 id="quota">Quota</h3> 229 230 <p>Applications using the Google Play Developer API are limited to an 231 initial courtesy usage quota of <strong>200,000 requests per day</strong> (per 232 application). This should provide enough access for publishing activities and 233 normal subscription-validation needs.</p> 234 235 <p>If you need to request a higher limit for your application, use the "Request 236 more" link on the <strong>Quotas</strong> 237 pane of the Google Developers Console.</p> 238