1page.title=Google Play Developer API
2page.tags="In-app Billing", "Google Play", "inapp billing", "in app billing", "iab", "billing", "publishing"
3page.image=/images/play_dev.jpg
4page.metaDescription=A REST-based web service for remote app publishing and catalog management through Google Play.
5
6
7@jd:body
8
9<div id="qv-wrapper">
10<div id="qv">
11  <h2>In this document</h2>
12  <!-- TODO: Update TOC -->
13  <ol>
14    <li><a href="#publishing_api_overview">Publishing API</a>
15    <li><a href="#subscriptions_api_overview">Subscriptions and In-App
16          Purchases API</a></li>
17    <li><a href="#using">Using the API</a>
18    <li><a href="#edits">Staged Edits</a></li>
19    <li><a href="#practices">Using the API Efficiently</a>
20      <ol>
21        <li><a href="#quota">Quota</a></li>
22      </ol>
23    </li>
24  </ol>
25
26  <h2>See also</h2>
27  <ol>
28    <li><a href="https://developers.google.com/android-publisher/">
29        Developer API reference</a></li>
30    <li><a href="https://support.google.com/googleplay/android-developer/answer/6071616">Google
31        Help Center</a> overview of the Google Play Developer API</li>
32  </ol>
33</div>
34</div>
35
36<p>The Google Play Developer API is a REST-based web service that allows you to perform publishing
37and app-management tasks. You can use this API to integrate your publishing
38operations with your release-management process.</p>
39
40<p>Not all developers will need to use these APIs&mdash;in most cases you will
41continue to manage your apps directly using the Google Play Developer Console.
42However, if you have a large number of APKs to manage, or have to track user
43purchases and subscriptions, you may find this API very useful.</p>
44
45<p>Using the Google Play Developer API, you can automate a variety of
46app-management tasks, including:</p>
47
48<ul>
49<li>Uploading and releasing new versions of your app</li>
50<li>Editing your app Google Play Store listings, including localized text and
51    graphics</li>
52<li>Managing your in-app product catalog, your products purchase status and your
53    app subscriptions</li>
54</li>
55</ul>
56
57<p>The Google Play Developer API lets you focus on designing and developing your
58app, while spending less time and effort managing your releases, even as you
59grow 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>
74The Google Play Developer Publishing API allows you to automate frequent tasks
75having to do with app distribution. This provides functions
76similar to those available to a developer through the Google Play
77Developer Console, such
78as:
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>
89functionality, which takes a transactional approach to making changes &mdash;
90you bundle several changes into a single draft edit, then commit the changes all
91at 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
94API. All the functionality provided by the API is also available through the
95Google Play
96Developer Console. However, this API lets you integrate your app and listing
97update process with your existing tools, which will be very useful for some
98developers. In particular, if you have a large number of APKs to manage, or
99localized 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
105subscriptions. In addition, with the Subscriptions and In-App Purchases API you
106can quickly retrieve the
107details of any purchase using a standard GET request. In the request you supply
108information about the purchase &mdash; app package name, purchase or
109subscription ID, and the purchase token. The server responds with a JSON object
110describing the associated purchase details, order status, developer payload, and
111other information.</p>
112
113<p>You can use the Purchase Status API in several ways, such as for reporting
114and reconciliation of individual orders and for verifying purchases and
115subscription expirations. You can also use the API to learn about cancelled
116orders and confirm whether in-app products have been consumed, including
117whether they were consumed before being cancelled.</p>
118
119<p class="note"><strong>Note:</strong> The Subscriptions and In-App
120Purchases API does not use the new, transactional "edits" functionality used by
121the <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>,
124and <a href="https://developers.google.com/android-publisher/api-ref/purchases/subscriptions">Purchases.subscriptions</a>
125resources take effect immediately. Each resource's API reference page notes
126specifically whether the methods for that resource use the "edits"
127model.</p>
128
129<p>The Purchase Status API is part of the <a
130href="https://developers.google.com/android-publisher/">Google Play Developer
131API</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, you’ll set up and manage the Google Play Developer
136API directly from the <a href="https://play.google.com/apps/publish/">Google
137Play Developer Console</a>. The API can only be managed by the owner of your
138Google 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
153Started</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
158and commit changes to your Google Play apps. Once your update is ready to go,
159you 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 app’s store listings</li>
167</ul>
168
169<p>Once all the desired changes have been staged, they are all committed with a
170single 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>
174page.</p>
175
176<p class="note"><strong>Note:</strong> The new, transactional "edits"
177functionality is only used by the <a href="#publishing_api_overview">Publishing
178API</a>. Methods for the <a href="#subscriptions_api_overview">Subscriptions and
179In-App Purchases API</a> take effect immediately. Each resource's API reference
180page notes specifically whether the methods for that resource use the "edits"
181model.</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
186high-performance environment for all applications that use it (as described in
187<a href="#quota">Quota</a>). While you can
188request a higher daily quota for your application, we highly recommend that you
189minimize your access using these techniques: </p>
190
191<ul>
192  <li><em>Limit the number of app updates</em> &mdash; 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> &mdash; 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> &mdash; 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> &mdash; 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> &mdash; 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
226best 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
231initial courtesy usage quota of <strong>200,000 requests per day</strong> (per
232application). This should provide enough access for publishing activities and
233normal subscription-validation needs.</p>
234
235<p>If you need to request a higher limit for your application, use the "Request
236more" link on the <strong>Quotas</strong>
237pane of the Google Developers Console.</p>
238