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