1page.title=Administering In-app Billing 2parent.title=In-app Billing 3parent.link=index.html 4@jd:body 5 6<div id="qv-wrapper"> 7<div id="qv"> 8 <h2>In this document</h2> 9 <ol> 10 <li><a href="#billing-list-setup">Creating a Product List</a></li> 11 <li><a href="#pricing-template">Pricing Templates</a></li> 12 <li><a href="#billing-purchase-type">Choosing a Product Type</a></li> 13 <li><a href="#billing-refunds">Handling Refunds</a></li> 14 <li><a href="#billing-refunds">Working with Order Numbers</a></li> 15 <li><a href="#billing-testing-setup">Setting up Test Accounts</a></li> 16 <li><a href="#billing-support">Where to Get Support</a></li> 17 </ol> 18 19 </ol> 20 <h2>See also</h2> 21 <ol> 22 <li><a href="{@docRoot}google/play/billing/billing_overview.html">Overview of In-app 23 Billing</a></li> 24 </ol> 25</div> 26</div> 27 28<p>In-app billing frees you from processing financial transactions, but you still need to perform a 29few administrative tasks. These tasks include the following:</p> 30<ul> 31 <li>Setting up and maintaining your product list on the Google Play Developer Console.</li> 32 <li>Registering test accounts.</li> 33 <li>Handling refunds when necessary.</li> 34</ul> 35</p> 36 37<p>To register a test account, you must have a Google Play publisher account. If you 38already have a publisher account on Google Play, you can use your existing account. You do not 39need to register for a new account to support in-app billing. If you don't have a publisher 40account, you can register as a Google Play developer and set up a publisher account through the <a 41href="http://play.google.com/apps/publish">Google Play Developer Console</a>.</p> 42 43<p>If you want to create a product list and issue refunds to your users, you must have a 44Google payments merchant account. If you don't have a merchant account, you can 45register for one through the Developer Console.</p> 46 47<h2 id="billing-list-setup">Creating a Product List</h2> 48 49<p>The Google Play Developer Console provides a product list for each of your published 50apps. You can sell an item using Google Play's in-app billing feature only if the item is 51listed on an app's product list. Each app has its own product list; you cannot sell 52items that appear on another app's product list.</p> 53 54<p>You can access an app's product list by opening the <em>In-app Products</em> 55page for an app that is listed in your developer account. The link to the 56<em>In-app Products</em> page appears only if you have a Google payments merchant 57account and the app's manifest includes the 58<code>com.android.vending.BILLING</code> permission. For more information about this 59permission, see <a href="{@docRoot}google/play/billing/billing_integrate.html#billing-permission"> 60Updating Your App's Manifest</a>.</p> 61 62<p>A product list specifies items you are selling in an app: in-app products, 63subscriptions, or a combination of both. For each item, the product list contains information 64such as product ID, product description, and price. You can create a product list for any 65published app, including apps published to the alpha and beta channels.</p> 66 67<p>The product list stores only metadata about the items you are selling in your app. 68It does not store any digital content. You are responsible for storing and delivering 69the digital content that you sell in your apps.</p> 70 71<p class="note"><strong>Note:</strong> Previously, you could test an app by 72uploading an unpublished draft version. This functionality is no longer 73supported; instead, you must publish it to the alpha or beta distribution 74channel. For more information, see <a 75href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps 76are No Longer Supported</a>.</p> 77 78<p>In addition, an app package can have only one product list. If you create a product 79list for an app, and you use the <a 80href="{@docRoot}google/play/publishing/multiple-apks.html">multiple APK feature</a> to distribute 81more than one APK for that app, the product list applies to all APK versions that are 82associated with the app listing. You cannot create individual product lists for each APK if 83you are using the multiple APK feature.</p> 84 85<p>You can add items to a product list two ways: you can add items one at a time on the <em>In-app 86Products</em> page, or you can add a batch of items by importing the items from a 87comma-separated values (CSV) file. Adding items one at a time is useful if your 88app has only a few in-app items or you are adding only a few items to a 89product list for testing purposes. The CSV file method is useful if your app has a large 90number of in-app items.</p> 91 92<p class="note"><strong>Note:</strong> Batch upload of product lists containing 93 subscriptions is not supported. Also, when updating existing items in a batch upload, 94 you cannot include changes to in-app products that are linked to a 95<a href="#pricing-template">pricing template</a>.</p> 96 97<h3 id="billing-form-add">Adding items one at a time to a product list</h3> 98 99<p>To add an item to a product list using the Developer Console UI, follow these steps:</p> 100 101<ol> 102 <li><a href="http://play.google.com/apps/publish">Log in</a> to your publisher account.</li> 103 <li>In the <em>All applications</em> panel, click on the 104 app name, then open the <em>In-app Products</em> page.</li> 105 <li><p>Click <strong>Add new product</strong>. After you provide the product type and ID for the item you are 106 selling, click <strong>Continue</strong>.</p> 107 <dl> 108 <dt>Product Type</dt> 109 <dd> 110 <p>The product type can be "Managed product" or "Subscription." You cannot 111 change an item's product type after you create the item. For more information, see 112 <a href="#billing-purchase-type">Choosing a Product Type</a>.</p> 113 <p class="note"><strong>Note: </strong>For subscription items, you cannot change the 114 item's price once you have published the item.</p> 115 </dd> 116 <dt>Product ID</dt> 117 <dd> 118 <p>Product IDs are unique across an app's namespace. A product ID must start with a 119 lowercase letter or a number and must be composed of only lowercase letters (a-z), numbers 120 (0-9), underscores (_), and periods (.). The product ID <code>android.test</code> is reserved, as are all 121 product IDs that start with <code>android.test</code>.</p> 122 <p class="note"><strong>Note: </strong>Be sure to plan your product ID namespace carefully. You 123 cannot modify an item's product ID after the item is created, and you cannot reuse 124 a product ID within an app.</p> 125 </dd> 126 </dl> 127 </li> 128 <li><p>Enter additional information about the item. If you're adding a 129 subscription, also include 130 <a href="#billing-form-add-subscription">subscription-specific details</a>. 131 After you've provided this information, click <strong>Save</strong>.</p> 132 <dl> 133 <dt>Publishing State</dt> 134 <dd> 135 <p>An item's publishing state can be <strong>Active</strong> or 136 <strong>Inactive</strong>. To be visible to a user during checkout, an item's publishing state must be set to 137 <strong>Active</strong>, and the item's app must be published on Google Play.</p> 138 <p class="note"><strong>Note:</strong> If you're using a test account, users can see active items 139 within unpublished apps, as well. For more information, see <a 140 href="{@docRoot}google/play/billing/billing_testing.html#billing-testing-real">Testing In-app 141 Billing</a>.</p> 142 </dd> 143 <dt>Languages and Translations</dt> 144 <dd> 145 <p>By default, in-app products inherit their default language from the parent app.</p> 146 <p>You can provide localized titles and descriptions for your in-app 147 products by selecting <strong>Add Translations</strong>. If you want Google 148 Play to translate your title and description for you, based on the title and 149 description in the default language, just choose the languages that you 150 want to offer. You can also provide custom translations in specific 151 languages.</p> 152 </dd> 153 <dt>Title</dt> 154 <dd> 155 The title is a short descriptor for the item. An example of a title is: "Sleeping potion." 156 Every item must have a title. The title is visible to users during checkout. For optimum appearance, 157 titles should be no longer than 25 characters; however, titles can be up to 55 characters in length. 158 </dd> 159 <dt>Description</dt> 160 <dd> 161 The description is a long descriptor for the item. An example of a description is: 162 "Instantly puts creatures to sleep. Does not work on angry elves." Every item must have a description. 163 Descriptions can be up to 80 characters in length. 164 </dd> 165 <dt>Price</dt> 166 <dd> 167 <p>Provide a price in your home currency, or link the price to an existing 168 pricing template. Based on the price you enter or the prices 169 from the pricing template, the system autofills country-specific prices for 170 different currencies. These generated prices use current exchange rates and 171 locally relevant pricing patterns (see figure 1).</p> 172 <p>You can also change prices for other currencies manually, but you can do 173 this only if a currency is used in one of the target countries for your 174 app. You can specify target countries for your app on the 175 <em>Pricing & Distribution</em> page in the Google Play 176 Developer Console.</p> 177 </dd> 178 </dl> 179 </li> 180</ol> 181 182<figure id="fig-elp"> 183 <img class="border-img" src="{@docRoot}images/in-app-billing/edit_local_prices.png" 184 width="700" alt="An item that costs 1.99 in USD usually costs a different 185 amount in AUD, EUR, or BOB. Some countries also add tax to the price."> 186 <figcaption> 187 <b>Figure 1. </b>Specifying additional currencies for an in-app product. 188 </figcaption> 189</figure> 190 191<h4 id="billing-form-add-subscription"> 192 Adding subscription details 193</h4> 194 195<p> 196 When you add a subscription to a product list, you must define its billing 197 period. All other settings related to subscriptions are optional. The 198 following list shows each property that you can set: 199</p> 200 201<dl> 202 <dt>Billing period</dt> 203 <dd> 204 <p> 205 Sets the frequency at which a user is charged while their subscription 206 is active. 207 </p> 208 209 <p> 210 If the billing period for the new subscription is Seasonal, you must 211 specify when the season starts and ends using the <strong>Start 212 date</strong> and <strong>End date</strong> options. The subscription is 213 active only between these two dates. 214 </p> 215 216 <p> 217 To allow users to activate a seasonal subscription for a discounted price 218 after the season begins, you can provide prorated pricing by selecting 219 <strong>Add Prorated Price</strong>. In the text boxes that appear after 220 you select this option, specify a discounted price for your subscription, 221 as well as the first date during the season when users can activate the 222 subscription for the discounted price. You can set multiple prorated 223 prices for a single subscription, with each price point taking effect on 224 a different start date. 225 </p> 226 227 <p class="note"> 228 <strong>Note:</strong> After you activate a subscription, you cannot 229 change the subscription's billing period. For a seasonal subscription, 230 this restriction means that you also cannot change the season's start and 231 end dates. However, you can still add, change, and remove the prorated 232 prices that you've associated with a seasonal subscription. 233 </p> 234 </dd> 235 236 <dt>Free trial period</dt> 237 <dd> 238 Sets the number of days that users can access the subscription for free 239 after they first activate it. The trial period must be at least 7 days. 240 </dd> 241 242 <dt>Grace period</dt> 243 <dd> 244 Determines the amount of time that the user can continue accessing the 245 subscription after their payment is declined. If the user doesn't fix their 246 payment issue after the grace period has ended, their access to the 247 subscription is revoked. 248 </dd> 249</dl> 250 251<p> 252 To learn more about how you can manage subscriptions using the In-app Billing 253 service, see the 254 <a href="/google/play/billing/billing_subscriptions.html">In-app 255 Subscriptions</a> guide. 256</p> 257 258<h3 id="billing-bulk-add">Adding a batch of items to a product list</h3> 259 260<p>To add a batch of items to a product list using a CSV file, you first need to 261create your CSV file. The data values that you specify in the CSV file represent 262the options that you set when adding in-app products to a product list using the 263Google Play Developer Console UI. For more information about using this UI, see 264<a href="#billing-form-add">Adding items one at a time to a product list</a>. 265 266<p class="note"><strong>Note:</strong> Batch upload of in-app product lists 267containing subscriptions is not supported. Also, when updating existing items in 268a batch upload, you cannot include changes to in-app products that are linked to 269a <a href="#pricing-template">pricing template</a>.</p> 270 271<p>To import the in-app products that are specified in your CSV file, do the 272following:</p> 273 274<ol> 275 <li> 276 <a href="http://play.google.com/apps/publish">Log in</a> to your 277 publisher account. 278 </li> 279 <li>In the <em>All applications</em> panel, select the app 280 name, then open the <em>In-app Products</em> page.</li> 281 <li> 282 <p>On the <em>In-app Products</em> page, click 283 <strong>Import/Export</strong> > <strong>Import in-app products from CSV 284 file</strong> to open the <em>Import In-app Products</em> dialog.</p> 285 </li> 286 <li> 287 <p> 288 If you want to overwrite existing in-app products in your product list 289 during the import process, select the <strong>Overwrite existing 290 products</strong> checkbox. 291 </p> 292 <p> 293 This option overwrites values of existing items only if the value of the 294 <code>Product ID</code> in the CSV file matches the in-app product ID for 295 an existing in-app product in the product list. The overwriting process 296 doesn't delete in-app products that exist in a product list but aren't 297 included in the CSV file 298 </p> 299 <p class="note"><strong>Note: </strong>If you choose not to overwrite 300 existing items, the <code>Product ID</code> given to each item in the CSV 301 file must be different from any of the <code>Product ID</code> values 302 assigned to existing in-app products. 303 </p> 304 </li> 305 <li> 306 Select <strong>Browse files</strong>, then choose the CSV file that contains 307 the items you want to import. The CSV file must be stored locally. 308 </li> 309</ol> 310 311<p> 312 You can also export an existing product list to a CSV file by clicking 313 <strong>Import/Export</strong> > <strong>Export in-app products to CSV file 314 </strong> on the <em>In-app Products page</em>. This is useful if you have 315 used the UI to add in-app products to your app but you want to start managing 316 the product list through a CSV file instead. 317</p> 318 319<h4 id="billing-bulk-format">Formatting batches of items</h4> 320 321<p> 322 The CSV file uses commas (<code>,</code>) and semicolons (<code>;</code>) to 323 separate data values. Commas are used to separate primary data values, and 324 semicolons are used to separate subvalues. Each item must appear entirely on a 325 single line within the CSV file. 326</p> 327<p> 328 When creating a CSV file that represents a list of items, you must specify the 329 CSV syntax on the first row, followed by the items themselves on subsequent 330 rows, as shown in the following example: 331</p> 332 333<pre class="no-pretty-print"> 334Product ID,Published State,Purchase Type,Auto Translate,Locale; Title; Description,Auto Fill Prices,Price,Pricing Template ID 335basic_sleeping_potion,published,managed_by_android,false,en_US; Basic Sleeping Potion; Puts small creatures to sleep.; es_ES; Poción básica de dormir; Causa las criaturas pequeñas ir a dormir.,false,,4637138456024710495 336standard_sleeping_potion,published,managed_by_android,false,en_US; Standard Sleeping Potion; Puts all creatures to sleep for 2 minutes.,true, 1990000, 337invisibility_potion,published,managed_by_android,false,en_US; Invisibility Potion; Invisible to all enemies for 5 minutes.,false, US; 1990000; BR; 6990000; RU; 129000000; IN; 130000000; ID; 27000000000; MX; 37000000; 338</pre> 339 340<p> 341 This example contains details for three items, each of which represents an 342 in-app product: 343</p> 344<ul> 345 <li> 346 The first item defines a title and description for the <code>en_US</code> 347 and <code>es_ES</code> locales. A pricing template defines the item's 348 price. 349 </li> 350 <li> 351 The second item doesn't use a pricing template. Instead, it specifies a 352 price for the default country (US). The Google Play Developer Console 353 uses current exchange rates and locally relevant pricing patterns to 354 automatically set the prices in all other countries where the app is 355 distributed. 356 </li> 357 <li> 358 The third item also doesn't use a pricing template. The item's price is 359 specified manually for each country where the app is distributed. 360 </li> 361</ul> 362 363<p> 364 Each row in a CSV file can contain the following values, though at least one 365 of these values is undefined in each row: 366</p> 367 368<dl> 369 <dt><code>Product ID</code></dt> 370 <dd> 371 <p> 372 Setting this value in the CSV file has the same effect as entering a 373 <em>Product ID</em> when creating a new in-app product. 374 </p> 375 <p> 376 If you specify a <code>Product ID</code> assigned to an in-app product that already 377 exists in a product list, and you've checked the <strong>Overwrite 378 existing products</strong> checkbox in the <em>Import In-app Products</em> 379 dialog, the data for the existing in-app product is overwritten with the 380 values that you specify in the CSV file. 381 </p> 382 </dd> 383 <dt><code>Publish State</code></dt> 384 <dd> 385 <p> 386 This value must be set to <code>published</code> 387 or <code>unpublished</code>. 388 </p> 389 <p> 390 Setting this value to <code>published</code> has the same effect as 391 navigating to an item's <em>Managed Product Details</em> page and choosing 392 <strong>Active</strong> in the drop-down list next to the in-app product's 393 title and product ID. Setting the value to <code>unpublished</code> 394 has the same effect as choosing <strong>Inactive</strong> in the same 395 drop-down list. 396 </p> 397 </dd> 398 <dt><code>Purchase Type</code></dt> 399 <dd> 400 <p> 401 This value must be set to <code>managed_by_android</code> because batch 402 upload of product lists containing subscriptions is not supported. 403 </p> 404 <p> 405 Setting this value to <code>managed_by_android</code> has the same effect 406 as selecting <strong>Managed product</strong> in the <em>Add New 407 Product</em> dialog when creating an in-app product. 408 </p> 409 </dd> 410 <dt><code>Auto Translate</code></dt> 411 <dd> 412 <p> 413 This value must be set to <code>false</code> because auto-translation of 414 in-app product details isn't supported. 415 </p> 416 <p> 417 If you want to provide translations of an in-app product's title and 418 description, you need to specify these translations explicitly within the 419 <code>Locale</code> value. 420 </p> 421 </dd> 422 <dt><code>Locale</code>, <code>Title</code>, and <code>Description</code></dt> 423 <dd> 424 <p> 425 If you include only one locale for an item, you must specify your app's 426 default locale and the item's default title and description: 427 </p> 428 429<pre class="no-pretty-print"> 430<var>app_default_locale</var>; <var>item_default_title</var>; <var>item_default_description</var>; 431</pre> 432 433 <p> 434 Setting these values has the same effect as performing the following 435 sequence of actions: 436 </p> 437 <ol> 438 <li> 439 Choosing a default language when you add a new app to your 440 publisher account. 441 </li> 442 <li> 443 Navigating to an in-app product's <em>Managed Product Details</em> page. 444 </li> 445 <li> 446 Specifying the in-app product's default title and description. 447 </li> 448 </ol> 449 <p> 450 When setting the <code>Locale</code> value, you can use any of the 451 language codes that appear within the <em>Add Your Own Translations</em> 452 dialog. You can access this dialog by navigating to an in-app product's 453 <em>Managed Product Details</em> page and clicking <strong>Add 454 translations</strong> or <strong>Manage translations</strong>. 455 </p> 456 <p class="note"> 457 <strong>Note: </strong>When specifying the <code>Title</code> and 458 <code>Description</code> values, use backslashes to escape the semicolon 459 (<code>\;</code>) and backslash (<code>\\</code>) characters. 460 </p> 461 <p> 462 If you want to include translated versions of the item's title and 463 description, you must list the default locale, title, and description, 464 followed by the locales, titles, and descriptions for each translation. 465 In the following example, the in-app product uses <code>en_US</code> 466 (United States English) as the default locale and <code>es_ES</code> 467 (Spain Spanish) as a translation: 468 </p> 469<pre class="no-pretty-print"> 470en_US; Invisibility Cloak; Makes you invisible.; es_ES; Capote Invisible; Se vuelven invisible. 471</pre> 472 <p class="note"> 473 <strong>Note: </strong>An app contains a single default language, but each 474 in-app product maintains its own list of translations. Therefore, although 475 the first locale in each item's <code>Locale</code> value must be the same 476 throughout the CSV file, the other locales can differ from one item to 477 another. 478 </p> 479 <p> 480 Providing values for multiple translations has the same effect as 481 performing the following sequence of actions: 482 </p> 483 <ol> 484 <li> 485 Navigating to an in-app product's <em>Managed Product Details</em> page. 486 </li> 487 <li> 488 Clicking <strong>Add translations</strong>. 489 </li> 490 <li> 491 Selecting the languages for the translations and clicking 492 <strong>Add</strong>. 493 </li> 494 <li> 495 Choosing one of the languages you added in the previous step. 496 </li> 497 <li> 498 Specifying a new title and description, which serve as translations into 499 the selected language. 500 </li> 501 <li> 502 Repeating steps 4 and 5 to add translations into all other non-default 503 languages. 504 </li> 505 </ol> 506 </dd> 507 <dt><code>Auto Fill Prices</code>, <code>Country</code>, and 508 <code>Price</code></dt> 509 <dd> 510 <p> 511 You can set <code>Auto Fill Prices</code> to <code>true</code> or 512 <code>false</code>. 513 If an in-app product uses a <a href="#pricing-template">pricing 514 template</a>, you should set <code>Auto Fill Prices</code> to 515 <code>false</code>, and you shouldn't set a value for the 516 <code>Price</code>. 517 </p> 518 <p class="note"> 519 <strong>Note: </strong>When you specify an item's price in a CSV file, you 520 provide a price in <em>micro-units</em>, where 1,000,000 micro-units is 521 equivalent to 1 unit of real currency. 522 </p> 523 <p> 524 The following sections describe how the value of 525 <code>Auto Fill Prices</code> affects the syntax and meaning of the 526 <code>Country</code> and <code>Price</code> values. 527 </p> 528 <h5>Using auto-filled prices</h5> 529 <p> 530 If you set <code>Auto Fill Prices</code> to <code>true</code>, you specify 531 only the item's default price; you don't include a <code>Country</code> 532 value. Setting <code>Auto Fill Prices</code> to <code>true</code> has the 533 same effect as performing the following sequence of actions: 534 </p> 535 <ol> 536 <li> 537 Navigating to an in-app product's <em>Managed Product Details</em> page. 538 </li> 539 <li> 540 Selecting <strong>Edit</strong> in the <em>Price</em> section. 541 </li> 542 <li> 543 Entering a default, tax-exclusive price. Auto-filled prices include tax. 544 </li> 545 <li> 546 Clicking the checkbox next to <em>COUNTRY</em> in the <em>Edit Local 547 Prices</em> dialog that appears. 548 </li> 549 <li> 550 Selecting <strong>Refresh exchange rates</strong>. 551 </li> 552 <li> 553 Selecting <strong>Apply</strong>. 554 </li> 555 </ol> 556 <p> 557 For example, under the following conditions: 558 </p> 559 <ul> 560 <li>Your app's default locale is <code>en_US</code>.</li> 561 <li>An in-app product's default, tax-exclusive price is $1.99.</li> 562 <li>You want the prices for other countries auto-filled.</li> 563 </ul> 564 <p> 565 ...you'd set the values of <code>Auto Fill Prices</code> and 566 <code>Price</code> at the end of a row in the CSV file as follows: 567 </p> 568 569<pre class="no-pretty-print"> 570true,1990000, 571</pre> 572 573 <h5>Not using auto-filled prices</h5> 574 <p> 575 If you set <code>Auto Fill Prices</code> to <code>false</code> instead, 576 you specify a series of <code>Country</code> and <code>Price</code> 577 values for all countries where you distribute your app, including the country corresponding to your app's default locale. 578 Each <code>Country</code> value is the two-letter uppercase <a 579 class="external-link" 580 href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO country 581 code</a> that represents a country where your app is distributed. 582 </p> 583 <p class="note"> 584 <strong>Note: </strong>You must provide a country code and price for each 585 country that your app is targeting. To view and edit the list of countries 586 that your app targets, open your app's <em>Pricing & Distribution</em> 587 page. 588 </p> 589 <p> 590 Each <code>Price</code> value represents the cost of the item in 591 micro-units of the currency used in that country. Setting <code>Auto Fill 592 Prices</code> to <code>false</code> has the same effect as performing 593 the following sequence of actions: 594 </p> 595 <ol> 596 <li> 597 Navigating to an in-app product's <em>Managed Product Details</em> page. 598 </li> 599 <li> 600 Selecting <strong>Edit</strong> in the <em>Price</em> section. 601 </li> 602 <li> 603 Explicitly setting tax-inclusive prices for different countries in the 604 <em>Edit Local Prices</em> dialog that appears. 605 </li> 606 <li> 607 Selecting <strong>Apply</strong>. 608 </li> 609 </ol> 610 <p> 611 For example, if you're offering your app for the following prices (all 612 taxes included) in other countries: 613 </p> 614 <ul> 615 <li>R$6.99 in Brazil.</li> 616 <li>129 ₽ in Russia.</li> 617 <li>₹130 in India.</li> 618 <li>Rp 27,000 in Indonesia.</li> 619 <li>$37 in Mexico.</li> 620 </ul> 621 <p> 622 ...you'd set the values of <code>Auto Fill Prices</code>, 623 <code>Country</code>, and <code>Price</code> at the end of a row in the 624 CSV file as follows: 625 </p> 626 627<pre class="no-pretty-print"> 628false, BR; 6990000; RU; 129000000; IN; 130000000; ID; 27000000000; MX; 37000000; 629</pre> 630 631 </dd> 632 <dt><code>Pricing Template ID</code></dt> 633 <dd> 634 <p> 635 If an item is linked to a pricing template, you should set <code>Auto Fill 636 Prices</code> to <code>false</code>, and you shouldn't set a value for the 637 <code>Price</code> column. If the item isn't linked to a pricing template, 638 you shouldn't set a value for the <code>Pricing Template ID</code>; instead, 639 you should set <code>Auto Fill Prices</code>, <code>Country</code>, and 640 <code>Price</code> based on how you want to set the in-app product's prices. 641 </p> 642 <p> 643 Setting this value has the same effect as navigating to an in-app product's 644 <em>Managed Product Details</em> page and linking the product's price to the 645 pricing template that has the same pricing template ID as the one specified 646 in the CSV file. This pricing template ID appears underneath a pricing 647 template's name on the <em>Pricing template</em> page. 648 </p> 649 <p> 650 If you import a CSV file, and you've checked the <strong>Overwrite existing 651 products</strong> checkbox in the <em>Import In-app Products</em> dialog, 652 you can update the links between in-app products and pricing templates. To 653 link the product to a specific pricing template, set the <code>Pricing 654 Template ID</code> value to that pricing template's ID. To unlink an in-app 655 product from all pricing templates, don't set a value for its <code>Pricing 656 Template ID</code>. 657 </p> 658 <p> 659 You can link up to 100 app prices or in-app product prices to a particular 660 pricing template. Therefore, don't specify the same <code>Pricing Template 661 ID</code> value in more than 100 rows of a CSV file. 662 </p> 663 </dd> 664</dl> 665 666<h2 id="pricing-template"> 667 Pricing Templates 668</h2> 669 670<p> 671 If you sell multiple apps at the same price, or if you sell multiple in-app 672 products at the same price across one or more apps, you can add <em>pricing 673 templates</em>. These templates make it easier to manage shared prices. 674</p> 675 676<h3 id="add-pricing-template"> 677 Adding a pricing template 678</h3> 679 680<p> 681 When creating a pricing template, you provide new pricing information that you 682 can apply to paid apps and in-app products. You can link the prices of up to 683 100 apps and in-app products to a single pricing template. 684</p> 685 686<p> 687 To add a pricing template, do the following: 688</p> 689 690<ol> 691 <li> 692 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 693 account. 694 </li> 695 696 <li>In the <em>Settings</em> panel, open the <em>Pricing 697 template</em> page. 698 </li> 699 700 <li> 701 <p> 702 If you are adding your first pricing template, the <em>Add a Pricing 703 Template</em> banner appears. Select <strong>Add template</strong> to 704 create a new template. The new template's <em>Pricing</em> tab appears. 705 </p> 706 707 <p> 708 Otherwise, you see a list of your pricing templates. Select <strong>New 709 pricing template</strong>. The new template's <em>Pricing</em> tab 710 appears. 711 </p> 712 </li> 713 714 <li> 715 <p> 716 Provide details about the template. These details include the name, the 717 price, and whether to include tax as part of your country-specific 718 prices. 719 </p> 720 <p> 721 Based on the price and tax option you provide, the Developer Console 722 generates prices for international currencies using current exchange 723 rates and country-specific pricing patterns. 724 </p> 725 </li> 726 <li>Select <strong>Create template</strong> to finish adding the template. 727 </li> 728</ol> 729 730<h3 id="link-pricing-template"> 731 Linking a pricing template 732</h3> 733 734<p> 735 You can create links between pricing templates and sets of paid apps and 736 in-app products that share the same price. After completing this linking 737 process, any changes you make to the pricing template are applied to the 738 prices of items that you've linked to the template. To complete the linking 739 process, use either the pricing template's <em>Linked Items</em> tab or the 740 Price section within a paid app or in-app product's pricing page. 741</p> 742 743<p class="note"> 744 <strong>Note:</strong> Since a subscription within your app has a constant 745 price, you cannot link a subscription with a pricing template. You can, 746 however, import the prices from a pricing template and apply them to a new 747 subscription. 748</p> 749 750<h4> 751 Linking a pricing template to in-app products and paid apps 752</h4> 753 754<p> 755 To link a pricing template to an in-app product, do the following: 756</p> 757 758<ol> 759 <li> 760 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 761 account. 762 </li> 763 764 <li>In the <em>Settings</em> panel, open the <em>Pricing 765 template</em> page. This page shows the list of pricing templates you have 766 created for your account. 767 </li> 768 769 <li>Choose an existing pricing template that you want to link to an in-app 770 product, then select the template's <em>Linked Items</em> tab. This tab shows 771 options to link your pricing template to in-app products and paid apps 772 (see figure 2). 773 </li> 774 775 <li>In the Link In-App Products section of the tab, enter or choose the name 776 of an app. This app should contain the in-app product that you want to link 777 to your pricing template. 778 </li> 779 780 <li>Based on the app that you selected, you see a list of in-app products 781 that are active and are not yet linked to a pricing template. Choose the 782 in-app product that you want to link to the pricing template by selecting the 783 <strong>Link</strong> button that appears in the same row as the in-app 784 product. 785 </li> 786 787 <li>The price of the in-app product is now linked to your pricing template. 788 Any changes you make to the prices within your pricing template affect the 789 prices of the linked in-app product. 790 </li> 791</ol> 792 793<p> 794 To link a pricing template to the price of a paid app, you follow a similar 795 process. On the pricing template's <em>Linked Items</em> tab, choose a paid 796 app in the Link Paid Apps section. 797</p> 798 799<figure id="fig-lpt"> 800 <img class="border-img" 801 src="{@docRoot}images/in-app-billing/link_pricing_template.png" width="700" 802 alt="The Sleeping Potion in-app product is linked to the Basic Inventory item, 803 but the Invisibility Potion is not."> 804 <figcaption> 805 <b>Figure 2. </b>On a pricing template's <em>Linked Items</em> tab, you can 806 change which in-app products and paid apps are linked to the pricing 807 template. 808 </figcaption> 809</figure> 810 811<h4> 812 Linking an in-app product or paid app to a pricing template 813</h4> 814 815<p> 816 To link an in-app product to a pricing template, do the following: 817</p> 818 819<ol> 820 <li> 821 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 822 account. 823 </li> 824 825 <li>In the <em>All applications</em> panel, select the app name, then 826 open the <em>In-app Products</em> page. 827 </li> 828 829 <li>Choose the in-app product that you want to link to a pricing template. 830 The item's details page appears. 831 </li> 832 833 <li>In the Pricing section, choose the pricing template that you want to link 834 to the price of this in-app product. 835 </li> 836 837 <li>The price of the in-app product is now linked to the pricing template you 838 selected. Any changes you make to the prices within your pricing template 839 affect the prices of this in-app product. 840 </li> 841</ol> 842 843<p> 844 To link the price of a paid app to a pricing template, you follow a similar 845 process on the app's <em>Pricing & Distribution</em> page. 846</p> 847 848<h3 id="delete-linked-item"> 849 Deleting an item that is linked to a pricing template 850</h3> 851 852<p> 853 As your app evolves, you may find it useful to remove older versions of 854 in-app products or unpublish paid apps, some of which may be linked to pricing 855 templates. To delete an in-app product or unpublish a paid app that is linked 856 to a pricing template, complete the following steps. You don't need to unlink 857 the in-app product or paid app from the pricing template beforehand. 858</p> 859 860<h4> 861 Deleting an in-app product that is linked to a template 862</h4> 863 864<p> 865 To delete an in-app product that is linked to a template, do the following: 866</p> 867 868<ol> 869 <li> 870 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 871 account. 872 </li> 873 874 <li>Select the app that contains the in-app product you want to delete. 875 </li> 876 877 <li>Open the app's <em>In-app Products</em> page. 878 </li> 879 880 <li>Choose the in-app product that you want to delete. 881 </li> 882 883 <li>Select the button that indicates whether the in-app product is active or 884 inactive (enclosed in a box within figure 3). The drop-down menu includes a 885 <strong>Delete</strong> option. 886 </li> 887 <li>Select <strong>Delete</strong>, then choose <strong>Yes</strong> in the 888 confirmation dialog that appears. 889 </li> 890</ol> 891 892<figure id="fig-diap"> 893 <img class="border-img" src="{@docRoot}images/in-app-billing/delete_iap.png" 894 width="500" alt=""> 895 <figcaption> 896 <b>Figure 3. </b>Deleting an in-app product that is linked to a pricing 897 template. 898 </figcaption> 899</figure> 900 901<h4> 902 Unpublishing a paid app that is linked to a template 903</h4> 904 905<div class="figure-right"> 906 <figure id="fig-upa"> 907 <img src="{@docRoot}images/in-app-billing/unpublish_paid_app.png" 908 width="700" alt=""> 909 <figcaption> 910 <b>Figure 4. </b>Unpublishing an app that has already been published and is 911 linked to a pricing template. 912 </figcaption> 913 </figure> 914</div> 915 916<p> 917 To unpublish a paid app that is already published and is linked to a template, 918 do the following: 919</p> 920 921<ol> 922 <li> 923 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 924 account. 925 </li> 926 927 <li>Select the app that you want to unpublish. 928 </li> 929 930 <li>Select <strong>Unpublish app</strong> (enclosed in a box within figure 4), 931 then choose <strong>Unpublish</strong> in the confirmation dialog that 932 appears. 933 </li> 934</ol> 935 936<h3 id="delete-pricing-template"> 937 Deleting a pricing template 938</h3> 939 940<p> 941 If you no longer need a pricing template, you can delete it by completing the 942 following steps: 943</p> 944 945<ol> 946 <li> 947 <a href="http://play.google.com/apps/publish">Log in</a> to your publisher 948 account. 949 </li> 950 951 <li>In the <em>Settings</em> panel, open the <em>Pricing 952 template</em> page, which shows the list of pricing templates you have 953 created for your account. 954 </li> 955 956 <li>Select the pricing template that you wish to delete. 957 </li> 958 959 <li>On the pricing template's <em>Linked Items</em> tab, unlink all in-app 960 products that are linked to the template.</li> 961 962 <li>Select <strong>Delete template</strong>. 963 </li> 964</ol> 965 966<h2 id="billing-purchase-type">Choosing a Product Type</h2> 967 968<p>An item's product type controls how Google Play manages the purchase of the item. The supported 969product types include "managed product" and "subscription." Since support for different product 970types can vary among versions of the In-app Billing API, make sure that you choose a product 971type that's valid for the version of the In-app Billing API that your app uses.</p> 972 973<p>For details, refer to the documentation for the <a 974href="{@docRoot}google/play/billing/api.html#producttype">In-app Billing API</a>.</p> 975 976<h2 id="billing-refunds">Handling Refunds</h2> 977 978<p>In-app billing does not allow users to send a refund request to Google Play. Refunds for 979in-app purchases must be directed to you (the app developer). You can then process the 980refund through your Google payments merchant account. When you do this, Google Play receives a 981refund notification from Google payments, and Google Play sends a refund message to your 982app. For more information, see <a 983href="{@docRoot}google/play/billing/v2/api.html#billing-action-notify">Handling 984IN_APP_NOTIFY messages</a> and <a 985href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1153485"> 986In-app Billing Pricing</a>.</p> 987 988<p class="caution"><strong>Important:</strong> You cannot use the API to issue 989refunds or cancel In-app Billing transactions. You must do this manually through your Google 990payments merchant account. However, you can use the API to retrieve order 991information.</p> 992 993<h2 id="orderId">Working with Order Numbers</h2> 994 995<p>When a user purchases an in-app item, Google assigns the transaction 996a unique and permanent order number. Google Play provides that order number to 997you at the conclusion of the purchase flow, as the value of the 998<code>orderId</code> field of the <code>PURCHASE_STATE_CHANGED</code> 999intent.</p> 1000 1001<p class="note"> 1002 <strong>Note:</strong> When a user completes a test purchase, the 1003 <code>orderId</code> field remains blank. To track test transactions, use 1004 the <code>purchaseToken</code> field instead. For more information about 1005 working with test purchases, see <a 1006 href="{@docRoot}google/play/billing/billing_testing.html">Testing In-app 1007 Billing</a>. 1008</p> 1009 1010<p>In your app, you can use the order number as a general-purpose identifier for 1011the in-app purchase transaction. After the purchase, you can use the order 1012number as a means of tracking the transaction in reconciliation reports and for 1013customer support.</p> 1014 1015<p>The order number itself is a string consisting of numbers only, with a format 1016assigned and managed by Google.</p> 1017 1018<p>For transactions dated 5 December 2012 or later, Google payments assigns a 1019Merchant Order Number (rather than a Google Order Number) and reports the Merchant 1020Order Number as the value of <code>orderID</code>. Here's an 1021example:</p> 1022 1023<pre>"orderId" : "GPA.1234-5678-9012-34567"</pre> 1024 1025<p>For transactions dated previous to 5 December 2012, Google checkout assigned 1026a Google Order Number and reported that number as the value of 1027<code>orderID</code>. Here's an example of an <code>orderID</code> holding a 1028Google Order Number:</p> 1029 1030<pre>"orderId" : "556515565155651"</pre> 1031 1032<h2 id="billing-testing-setup">Setting Up Test Accounts</h2> 1033 1034<p>The Google Play Developer Console lets you set up one or more test accounts. 1035A test account is a regular Google account that you register on the Developer 1036Console as a test account. Test accounts are authorized to make in-app purchases 1037from apps that you have uploaded to the Google Play Developer Console 1038but have not yet published.</p> 1039 1040<p>You can use any Google account as a test account. Test accounts are useful if you want to let 1041multiple people test In-app Billing on apps without giving them access to your publisher 1042account's sign-in credentials. If you want to own and control the test accounts, you can create the 1043accounts yourself and distribute the credentials to your developers or testers.</p> 1044 1045<p>Test accounts have three limitations:</p> 1046 1047<ul> 1048 <li>Test account users can make purchase requests only within apps that are already 1049 uploaded to your publisher account (although the app doesn't need to be published).</li> 1050 <li>Test accounts can only be used to purchase items that are listed (and published) in an 1051 app's product list.</li> 1052 <li>Test account users do not have access to your publisher account and cannot upload apps 1053 to your publisher account.</li> 1054</ul> 1055 1056<p>To add test accounts to your publisher account, follow these steps:</p> 1057 1058<ol> 1059 <li><a href="http://play.google.com/apps/publish">Log in</a> to your publisher account.</li> 1060 <li>Click the <strong>Settings</strong> icon.</li> 1061 <li>Locate the License Testing panel.</li> 1062 <li>Add the email addresses for the test accounts you want to register, 1063 separating each account with a comma.</li> 1064 <li>Click <strong>Save</strong> to save your profile changes.</li> 1065</ol> 1066 1067<h3 id="license_key">Getting an app's license key</h3> 1068 1069<p>The Google Play Developer Console provides a public licensing key for each 1070app.</p> 1071 1072<p>To locate the key for an app, follow these steps:</p> 1073<ol> 1074 <li>Open the <em>All applications</em> panel.</li> 1075 <li>Click on the app name, then open the <em>Services & APIs</em> 1076 page.</li> 1077 <li>Scroll down to the section of the page labeled Your License Key for This 1078 Application, as shown in figure 5.</li> 1079</ol> 1080<p>Previously, the Developer Console provided a single public key per developer 1081account. To transition apps to the new per-app public key, the Developer Console 1082sets the app-specific key as the former developer key. This ensures compatibility 1083for apps that depend on the (former) developer key. </p> 1084 1085<figure id="fig-bak"> 1086 <img class="border-img" src="{@docRoot}images/in-app-billing/billing_app_key.png" 1087 width="700" alt=""> 1088 <figcaption> 1089 <b>Figure 5. </b>You can find the license key for each app on the 1090 <em>Services & APIs</em> page. 1091 </figcaption> 1092</figure> 1093 1094<h2 id="billing-support">Where to Get Support</h2> 1095 1096<p>If you have questions or encounter problems while implementing In-app Billing, contact the 1097support resources listed in the following table (see table 2). By directing your queries to the 1098correct forum, you can get the support you need more quickly.</p> 1099 1100<p class="table-caption" id="support-table"><strong>Table 2.</strong> Developer support resources 1101for Google Play In-app Billing.</p> 1102 1103<table> 1104 1105<tr> 1106<th>Support Type</th> 1107<th>Resource</th> 1108<th>Range of Topics</th> 1109</tr> 1110<tr> 1111<td rowspan="2">Development and testing issues</td> 1112<td>Google Groups: <a 1113href="http://groups.google.com/group/android-developers">android-developers</a> </td> 1114<td rowspan="2">In-app billing integration questions, user experience ideas, handling of responses, 1115obfuscating code, IPC, test environment setup.</td> 1116</tr> 1117<tr> 1118<td>Stack Overflow: <a 1119href="http://stackoverflow.com/questions/tagged/android">http://stackoverflow.com/questions/tagged/ 1120android</a></td> 1121</tr> 1122<tr> 1123<td>Billing issue tracker</td> 1124<td><a href="http://code.google.com/p/marketbilling/issues/">Billing 1125project issue tracker</a></td> 1126<td>Bug and issue reports related specifically to In-app Billing sample code.</td> 1127</tr> 1128</table> 1129 1130<p>For general information about how to post to the groups listed above, see <a 1131href="{@docRoot}resources/community-groups.html">Developer Forums</a> document in the Resources 1132tab.</p> 1133