blob: 1dc58e2516bee292f4a5b7f8661a743cb471d0e3 [file] [log] [blame]
page.title=Administering In-app Billing
parent.title=In-app Billing
parent.link=index.html
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol>
<li><a href="#billing-list-setup">Creating a Product List</a></li>
<li><a href="#pricing-template">Pricing Templates</a></li>
<li><a href="#billing-purchase-type">Choosing a Product Type</a></li>
<li><a href="#billing-refunds">Handling Refunds</a></li>
<li><a href="#billing-refunds">Working with Order Numbers</a></li>
<li><a href="#billing-testing-setup">Setting up Test Accounts</a></li>
<li><a href="#billing-support">Where to Get Support</a></li>
</ol>
</ol>
<h2>See also</h2>
<ol>
<li><a href="{@docRoot}google/play/billing/billing_overview.html">Overview of In-app
Billing</a></li>
</ol>
</div>
</div>
<p>In-app billing frees you from processing financial transactions, but you still need to perform a
few administrative tasks. These tasks include the following:</p>
<ul>
<li>Setting up and maintaining your product list on the Google Play Developer Console.</li>
<li>Registering test accounts.</li>
<li>Handling refunds when necessary.</li>
</ul>
</p>
<p>To register a test account, you must have a Google Play publisher account. If you
already have a publisher account on Google Play, you can use your existing account. You do not
need to register for a new account to support in-app billing. If you don't have a publisher
account, you can register as a Google Play developer and set up a publisher account through the <a
href="http://play.google.com/apps/publish">Google Play Developer Console</a>.</p>
<p>If you want to create a product list and issue refunds to your users, you must have a
Google payments merchant account. If you don't have a merchant account, you can
register for one through the Developer Console.</p>
<h2 id="billing-list-setup">Creating a Product List</h2>
<p>The Google Play Developer Console provides a product list for each of your published
apps. You can sell an item using Google Play's in-app billing feature only if the item is
listed on an app's product list. Each app has its own product list; you cannot sell
items that appear on another app's product list.</p>
<p>You can access an app's product list by opening the <em>In-app Products</em>
page for an app that is listed in your developer account. The link to the
<em>In-app Products</em> page appears only if you have a Google payments merchant
account and the app's manifest includes the
<code>com.android.vending.BILLING</code> permission. For more information about this
permission, see <a href="{@docRoot}google/play/billing/billing_integrate.html#billing-permission">
Updating Your App's Manifest</a>.</p>
<p>A product list specifies items you are selling in an app: in-app products,
subscriptions, or a combination of both. For each item, the product list contains information
such as product ID, product description, and price. You can create a product list for any
published app, including apps published to the alpha and beta channels.</p>
<p>The product list stores only metadata about the items you are selling in your app.
It does not store any digital content. You are responsible for storing and delivering
the digital content that you sell in your apps.</p>
<p class="note"><strong>Note:</strong> Previously, you could test an app by
uploading an unpublished draft version. This functionality is no longer
supported; instead, you must publish it to the alpha or beta distribution
channel. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps
are No Longer Supported</a>.</p>
<p>In addition, an app package can have only one product list. If you create a product
list for an app, and you use the <a
href="{@docRoot}google/play/publishing/multiple-apks.html">multiple APK feature</a> to distribute
more than one APK for that app, the product list applies to all APK versions that are
associated with the app listing. You cannot create individual product lists for each APK if
you are using the multiple APK feature.</p>
<p>You can add items to a product list two ways: you can add items one at a time on the <em>In-app
Products</em> page, or you can add a batch of items by importing the items from a
comma-separated values (CSV) file. Adding items one at a time is useful if your
app has only a few in-app items or you are adding only a few items to a
product list for testing purposes. The CSV file method is useful if your app has a large
number of in-app items.</p>
<p class="note"><strong>Note:</strong> Batch upload of product lists containing
subscriptions is not supported. Also, when updating existing items in a batch upload,
you cannot include changes to in-app products that are linked to a
<a href="#pricing-template">pricing template</a>.</p>
<h3 id="billing-form-add">Adding items one at a time to a product list</h3>
<p>To add an item to a product list using the Developer Console UI, follow these steps:</p>
<ol>
<li><a href="http://play.google.com/apps/publish">Log in</a> to your publisher account.</li>
<li>In the <em>All applications</em> panel, click on the
app name, then open the <em>In-app Products</em> page.</li>
<li><p>Click <strong>Add new product</strong>. After you provide the product type and ID for the item you are
selling, click <strong>Continue</strong>.</p>
<dl>
<dt>Product Type</dt>
<dd>
<p>The product type can be "Managed product" or "Subscription." You cannot
change an item's product type after you create the item. For more information, see
<a href="#billing-purchase-type">Choosing a Product Type</a>.</p>
<p class="note"><strong>Note: </strong>For subscription items, you cannot change the
item's price once you have published the item.</p>
</dd>
<dt>Product ID</dt>
<dd>
<p>Product IDs are unique across an app's namespace. A product ID must start with a
lowercase letter or a number and must be composed of only lowercase letters (a-z), numbers
(0-9), underscores (_), and periods (.). The product ID <code>android.test</code> is reserved, as are all
product IDs that start with <code>android.test</code>.</p>
<p class="note"><strong>Note: </strong>Be sure to plan your product ID namespace carefully. You
cannot modify an item's product ID after the item is created, and you cannot reuse
a product ID within an app.</p>
</dd>
</dl>
</li>
<li><p>Enter additional information about the item. If you're adding a
subscription, also include
<a href="#billing-form-add-subscription">subscription-specific details</a>.
After you've provided this information, click <strong>Save</strong>.</p>
<dl>
<dt>Publishing State</dt>
<dd>
<p>An item's publishing state can be <strong>Active</strong> or
<strong>Inactive</strong>. To be visible to a user during checkout, an item's publishing state must be set to
<strong>Active</strong>, and the item's app must be published on Google Play.</p>
<p class="note"><strong>Note:</strong> If you're using a test account, users can see active items
within unpublished apps, as well. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#billing-testing-real">Testing In-app
Billing</a>.</p>
</dd>
<dt>Languages and Translations</dt>
<dd>
<p>By default, in-app products inherit their default language from the parent app.</p>
<p>You can provide localized titles and descriptions for your in-app
products by selecting <strong>Add Translations</strong>. If you want Google
Play to translate your title and description for you, based on the title and
description in the default language, just choose the languages that you
want to offer. You can also provide custom translations in specific
languages.</p>
</dd>
<dt>Title</dt>
<dd>
The title is a short descriptor for the item. An example of a title is: "Sleeping potion."
Every item must have a title. The title is visible to users during checkout. For optimum appearance,
titles should be no longer than 25 characters; however, titles can be up to 55 characters in length.
</dd>
<dt>Description</dt>
<dd>
The description is a long descriptor for the item. An example of a description is:
"Instantly puts creatures to sleep. Does not work on angry elves." Every item must have a description.
Descriptions can be up to 80 characters in length.
</dd>
<dt>Price</dt>
<dd>
<p>Provide a price in your home currency, or link the price to an existing
pricing template. Based on the price you enter or the prices
from the pricing template, the system autofills country-specific prices for
different currencies. These generated prices use current exchange rates and
locally relevant pricing patterns (see figure 1).</p>
<p>You can also change prices for other currencies manually, but you can do
this only if a currency is used in one of the target countries for your
app. You can specify target countries for your app on the
<em>Pricing &amp; Distribution</em> page in the Google Play
Developer Console.</p>
</dd>
</dl>
</li>
</ol>
<figure id="fig-elp">
<img class="border-img" src="{@docRoot}images/in-app-billing/edit_local_prices.png"
width="700" alt="An item that costs 1.99 in USD usually costs a different
amount in AUD, EUR, or BOB. Some countries also add tax to the price.">
<figcaption>
<b>Figure 1. </b>Specifying additional currencies for an in-app product.
</figcaption>
</figure>
<h4 id="billing-form-add-subscription">
Adding subscription details
</h4>
<p>
When you add a subscription to a product list, you must define its billing
period. All other settings related to subscriptions are optional. The
following list shows each property that you can set:
</p>
<dl>
<dt>Billing period</dt>
<dd>
<p>
Sets the frequency at which a user is charged while their subscription
is active.
</p>
<p>
If the billing period for the new subscription is Seasonal, you must
specify when the season starts and ends using the <strong>Start
date</strong> and <strong>End date</strong> options. The subscription is
active only between these two dates.
</p>
<p>
To allow users to activate a seasonal subscription for a discounted price
after the season begins, you can provide prorated pricing by selecting
<strong>Add Prorated Price</strong>. In the text boxes that appear after
you select this option, specify a discounted price for your subscription,
as well as the first date during the season when users can activate the
subscription for the discounted price. You can set multiple prorated
prices for a single subscription, with each price point taking effect on
a different start date.
</p>
<p class="note">
<strong>Note:</strong> After you activate a subscription, you cannot
change the subscription's billing period. For a seasonal subscription,
this restriction means that you also cannot change the season's start and
end dates. However, you can still add, change, and remove the prorated
prices that you've associated with a seasonal subscription.
</p>
</dd>
<dt>Free trial period</dt>
<dd>
Sets the number of days that users can access the subscription for free
after they first activate it. The trial period must be at least 7 days.
</dd>
<dt>Grace period</dt>
<dd>
Determines the amount of time that the user can continue accessing the
subscription after their payment is declined. If the user doesn't fix their
payment issue after the grace period has ended, their access to the
subscription is revoked.
</dd>
</dl>
<p>
To learn more about how you can manage subscriptions using the In-app Billing
service, see the
<a href="/google/play/billing/billing_subscriptions.html">In-app
Subscriptions</a> guide.
</p>
<h3 id="billing-bulk-add">Adding a batch of items to a product list</h3>
<p>To add a batch of items to a product list using a CSV file, you first need to
create your CSV file. The data values that you specify in the CSV file represent
the options that you set when adding in-app products to a product list using the
Google Play Developer Console UI. For more information about using this UI, see
<a href="#billing-form-add">Adding items one at a time to a product list</a>.
<p class="note"><strong>Note:</strong> Batch upload of in-app product lists
containing subscriptions is not supported. Also, when updating existing items in
a batch upload, you cannot include changes to in-app products that are linked to
a <a href="#pricing-template">pricing template</a>.</p>
<p>To import the in-app products that are specified in your CSV file, do the
following:</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your
publisher account.
</li>
<li>In the <em>All applications</em> panel, select the app
name, then open the <em>In-app Products</em> page.</li>
<li>
<p>On the <em>In-app Products</em> page, click
<strong>Import/Export</strong> &gt; <strong>Import in-app products from CSV
file</strong> to open the <em>Import In-app Products</em> dialog.</p>
</li>
<li>
<p>
If you want to overwrite existing in-app products in your product list
during the import process, select the <strong>Overwrite existing
products</strong> checkbox.
</p>
<p>
This option overwrites values of existing items only if the value of the
<code>Product ID</code> in the CSV file matches the in-app product ID for
an existing in-app product in the product list. The overwriting process
doesn't delete in-app products that exist in a product list but aren't
included in the CSV file
</p>
<p class="note"><strong>Note: </strong>If you choose not to overwrite
existing items, the <code>Product ID</code> given to each item in the CSV
file must be different from any of the <code>Product ID</code> values
assigned to existing in-app products.
</p>
</li>
<li>
Select <strong>Browse files</strong>, then choose the CSV file that contains
the items you want to import. The CSV file must be stored locally.
</li>
</ol>
<p>
You can also export an existing product list to a CSV file by clicking
<strong>Import/Export</strong> &gt; <strong>Export in-app products to CSV file
</strong> on the <em>In-app Products page</em>. This is useful if you have
used the UI to add in-app products to your app but you want to start managing
the product list through a CSV file instead.
</p>
<h4 id="billing-bulk-format">Formatting batches of items</h4>
<p>
The CSV file uses commas (<code>,</code>) and semicolons (<code>;</code>) to
separate data values. Commas are used to separate primary data values, and
semicolons are used to separate subvalues. Each item must appear entirely on a
single line within the CSV file.
</p>
<p>
When creating a CSV file that represents a list of items, you must specify the
CSV syntax on the first row, followed by the items themselves on subsequent
rows, as shown in the following example:
</p>
<pre class="no-pretty-print">
Product ID,Published State,Purchase Type,Auto Translate,Locale; Title; Description,Auto Fill Prices,Price,Pricing Template ID
basic_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
standard_sleeping_potion,published,managed_by_android,false,en_US; Standard Sleeping Potion; Puts all creatures to sleep for 2 minutes.,true, 1990000,
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;
</pre>
<p>
This example contains details for three items, each of which represents an
in-app product:
</p>
<ul>
<li>
The first item defines a title and description for the <code>en_US</code>
and <code>es_ES</code> locales. A pricing template defines the item's
price.
</li>
<li>
The second item doesn't use a pricing template. Instead, it specifies a
price for the default country (US). The Google Play Developer Console
uses current exchange rates and locally relevant pricing patterns to
automatically set the prices in all other countries where the app is
distributed.
</li>
<li>
The third item also doesn't use a pricing template. The item's price is
specified manually for each country where the app is distributed.
</li>
</ul>
<p>
Each row in a CSV file can contain the following values, though at least one
of these values is undefined in each row:
</p>
<dl>
<dt><code>Product ID</code></dt>
<dd>
<p>
Setting this value in the CSV file has the same effect as entering a
<em>Product ID</em> when creating a new in-app product.
</p>
<p>
If you specify a <code>Product ID</code> assigned to an in-app product that already
exists in a product list, and you've checked the <strong>Overwrite
existing products</strong> checkbox in the <em>Import In-app Products</em>
dialog, the data for the existing in-app product is overwritten with the
values that you specify in the CSV file.
</p>
</dd>
<dt><code>Publish State</code></dt>
<dd>
<p>
This value must be set to <code>published</code>
or <code>unpublished</code>.
</p>
<p>
Setting this value to <code>published</code> has the same effect as
navigating to an item's <em>Managed Product Details</em> page and choosing
<strong>Active</strong> in the drop-down list next to the in-app product's
title and product ID. Setting the value to <code>unpublished</code>
has the same effect as choosing <strong>Inactive</strong> in the same
drop-down list.
</p>
</dd>
<dt><code>Purchase Type</code></dt>
<dd>
<p>
This value must be set to <code>managed_by_android</code> because batch
upload of product lists containing subscriptions is not supported.
</p>
<p>
Setting this value to <code>managed_by_android</code> has the same effect
as selecting <strong>Managed product</strong> in the <em>Add New
Product</em> dialog when creating an in-app product.
</p>
</dd>
<dt><code>Auto Translate</code></dt>
<dd>
<p>
This value must be set to <code>false</code> because auto-translation of
in-app product details isn't supported.
</p>
<p>
If you want to provide translations of an in-app product's title and
description, you need to specify these translations explicitly within the
<code>Locale</code> value.
</p>
</dd>
<dt><code>Locale</code>, <code>Title</code>, and <code>Description</code></dt>
<dd>
<p>
If you include only one locale for an item, you must specify your app's
default locale and the item's default title and description:
</p>
<pre class="no-pretty-print">
<var>app_default_locale</var>; <var>item_default_title</var>; <var>item_default_description</var>;
</pre>
<p>
Setting these values has the same effect as performing the following
sequence of actions:
</p>
<ol>
<li>
Choosing a default language when you add a new app to your
publisher account.
</li>
<li>
Navigating to an in-app product's <em>Managed Product Details</em> page.
</li>
<li>
Specifying the in-app product's default title and description.
</li>
</ol>
<p>
When setting the <code>Locale</code> value, you can use any of the
language codes that appear within the <em>Add Your Own Translations</em>
dialog. You can access this dialog by navigating to an in-app product's
<em>Managed Product Details</em> page and clicking <strong>Add
translations</strong> or <strong>Manage translations</strong>.
</p>
<p class="note">
<strong>Note: </strong>When specifying the <code>Title</code> and
<code>Description</code> values, use backslashes to escape the semicolon
(<code>\;</code>) and backslash (<code>\\</code>) characters.
</p>
<p>
If you want to include translated versions of the item's title and
description, you must list the default locale, title, and description,
followed by the locales, titles, and descriptions for each translation.
In the following example, the in-app product uses <code>en_US</code>
(United States English) as the default locale and <code>es_ES</code>
(Spain Spanish) as a translation:
</p>
<pre class="no-pretty-print">
en_US; Invisibility Cloak; Makes you invisible.; es_ES; Capote Invisible; Se vuelven invisible.
</pre>
<p class="note">
<strong>Note: </strong>An app contains a single default language, but each
in-app product maintains its own list of translations. Therefore, although
the first locale in each item's <code>Locale</code> value must be the same
throughout the CSV file, the other locales can differ from one item to
another.
</p>
<p>
Providing values for multiple translations has the same effect as
performing the following sequence of actions:
</p>
<ol>
<li>
Navigating to an in-app product's <em>Managed Product Details</em> page.
</li>
<li>
Clicking <strong>Add translations</strong>.
</li>
<li>
Selecting the languages for the translations and clicking
<strong>Add</strong>.
</li>
<li>
Choosing one of the languages you added in the previous step.
</li>
<li>
Specifying a new title and description, which serve as translations into
the selected language.
</li>
<li>
Repeating steps 4 and 5 to add translations into all other non-default
languages.
</li>
</ol>
</dd>
<dt><code>Auto Fill Prices</code>, <code>Country</code>, and
<code>Price</code></dt>
<dd>
<p>
You can set <code>Auto Fill Prices</code> to <code>true</code> or
<code>false</code>.
If an in-app product uses a <a href="#pricing-template">pricing
template</a>, you should set <code>Auto Fill Prices</code> to
<code>false</code>, and you shouldn't set a value for the
<code>Price</code>.
</p>
<p class="note">
<strong>Note: </strong>When you specify an item's price in a CSV file, you
provide a price in <em>micro-units</em>, where 1,000,000 micro-units is
equivalent to 1 unit of real currency.
</p>
<p>
The following sections describe how the value of
<code>Auto Fill Prices</code> affects the syntax and meaning of the
<code>Country</code> and <code>Price</code> values.
</p>
<h5>Using auto-filled prices</h5>
<p>
If you set <code>Auto Fill Prices</code> to <code>true</code>, you specify
only the item's default price; you don't include a <code>Country</code>
value. Setting <code>Auto Fill Prices</code> to <code>true</code> has the
same effect as performing the following sequence of actions:
</p>
<ol>
<li>
Navigating to an in-app product's <em>Managed Product Details</em> page.
</li>
<li>
Selecting <strong>Edit</strong> in the <em>Price</em> section.
</li>
<li>
Entering a default, tax-exclusive price. Auto-filled prices include tax.
</li>
<li>
Clicking the checkbox next to <em>COUNTRY</em> in the <em>Edit Local
Prices</em> dialog that appears.
</li>
<li>
Selecting <strong>Refresh exchange rates</strong>.
</li>
<li>
Selecting <strong>Apply</strong>.
</li>
</ol>
<p>
For example, under the following conditions:
</p>
<ul>
<li>Your app's default locale is <code>en_US</code>.</li>
<li>An in-app product's default, tax-exclusive price is $1.99.</li>
<li>You want the prices for other countries auto-filled.</li>
</ul>
<p>
...you'd set the values of <code>Auto Fill Prices</code> and
<code>Price</code> at the end of a row in the CSV file as follows:
</p>
<pre class="no-pretty-print">
true,1990000,
</pre>
<h5>Not using auto-filled prices</h5>
<p>
If you set <code>Auto Fill Prices</code> to <code>false</code> instead,
you specify a series of <code>Country</code> and <code>Price</code>
values for all countries where you distribute your app, including the country corresponding to your app's default locale.
Each <code>Country</code> value is the two-letter uppercase <a
class="external-link"
href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO country
code</a> that represents a country where your app is distributed.
</p>
<p class="note">
<strong>Note: </strong>You must provide a country code and price for each
country that your app is targeting. To view and edit the list of countries
that your app targets, open your app's <em>Pricing &amp; Distribution</em>
page.
</p>
<p>
Each <code>Price</code> value represents the cost of the item in
micro-units of the currency used in that country. Setting <code>Auto Fill
Prices</code> to <code>false</code> has the same effect as performing
the following sequence of actions:
</p>
<ol>
<li>
Navigating to an in-app product's <em>Managed Product Details</em> page.
</li>
<li>
Selecting <strong>Edit</strong> in the <em>Price</em> section.
</li>
<li>
Explicitly setting tax-inclusive prices for different countries in the
<em>Edit Local Prices</em> dialog that appears.
</li>
<li>
Selecting <strong>Apply</strong>.
</li>
</ol>
<p>
For example, if you're offering your app for the following prices (all
taxes included) in other countries:
</p>
<ul>
<li>R$6.99 in Brazil.</li>
<li>129&nbsp;&#8381; in Russia.</li>
<li>&#8377;130 in India.</li>
<li>Rp&nbsp;27,000 in Indonesia.</li>
<li>$37 in Mexico.</li>
</ul>
<p>
...you'd set the values of <code>Auto Fill Prices</code>,
<code>Country</code>, and <code>Price</code> at the end of a row in the
CSV file as follows:
</p>
<pre class="no-pretty-print">
false, BR; 6990000; RU; 129000000; IN; 130000000; ID; 27000000000; MX; 37000000;
</pre>
</dd>
<dt><code>Pricing Template ID</code></dt>
<dd>
<p>
If an item is linked to a pricing template, you should set <code>Auto Fill
Prices</code> to <code>false</code>, and you shouldn't set a value for the
<code>Price</code> column. If the item isn't linked to a pricing template,
you shouldn't set a value for the <code>Pricing Template ID</code>; instead,
you should set <code>Auto Fill Prices</code>, <code>Country</code>, and
<code>Price</code> based on how you want to set the in-app product's prices.
</p>
<p>
Setting this value has the same effect as navigating to an in-app product's
<em>Managed Product Details</em> page and linking the product's price to the
pricing template that has the same pricing template ID as the one specified
in the CSV file. This pricing template ID appears underneath a pricing
template's name on the <em>Pricing template</em> page.
</p>
<p>
If you import a CSV file, and you've checked the <strong>Overwrite existing
products</strong> checkbox in the <em>Import In-app Products</em> dialog,
you can update the links between in-app products and pricing templates. To
link the product to a specific pricing template, set the <code>Pricing
Template ID</code> value to that pricing template's ID. To unlink an in-app
product from all pricing templates, don't set a value for its <code>Pricing
Template ID</code>.
</p>
<p>
You can link up to 100 app prices or in-app product prices to a particular
pricing template. Therefore, don't specify the same <code>Pricing Template
ID</code> value in more than 100 rows of a CSV file.
</p>
</dd>
</dl>
<h2 id="pricing-template">
Pricing Templates
</h2>
<p>
If you sell multiple apps at the same price, or if you sell multiple in-app
products at the same price across one or more apps, you can add <em>pricing
templates</em>. These templates make it easier to manage shared prices.
</p>
<h3 id="add-pricing-template">
Adding a pricing template
</h3>
<p>
When creating a pricing template, you provide new pricing information that you
can apply to paid apps and in-app products. You can link the prices of up to
100 apps and in-app products to a single pricing template.
</p>
<p>
To add a pricing template, do the following:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>In the <em>Settings</em> panel, open the <em>Pricing
template</em> page.
</li>
<li>
<p>
If you are adding your first pricing template, the <em>Add a Pricing
Template</em> banner appears. Select <strong>Add template</strong> to
create a new template. The new template's <em>Pricing</em> tab appears.
</p>
<p>
Otherwise, you see a list of your pricing templates. Select <strong>New
pricing template</strong>. The new template's <em>Pricing</em> tab
appears.
</p>
</li>
<li>
<p>
Provide details about the template. These details include the name, the
price, and whether to include tax as part of your country-specific
prices.
</p>
<p>
Based on the price and tax option you provide, the Developer Console
generates prices for international currencies using current exchange
rates and country-specific pricing patterns.
</p>
</li>
<li>Select <strong>Create template</strong> to finish adding the template.
</li>
</ol>
<h3 id="link-pricing-template">
Linking a pricing template
</h3>
<p>
You can create links between pricing templates and sets of paid apps and
in-app products that share the same price. After completing this linking
process, any changes you make to the pricing template are applied to the
prices of items that you've linked to the template. To complete the linking
process, use either the pricing template's <em>Linked Items</em> tab or the
Price section within a paid app or in-app product's pricing page.
</p>
<p class="note">
<strong>Note:</strong> Since a subscription within your app has a constant
price, you cannot link a subscription with a pricing template. You can,
however, import the prices from a pricing template and apply them to a new
subscription.
</p>
<h4>
Linking a pricing template to in-app products and paid apps
</h4>
<p>
To link a pricing template to an in-app product, do the following:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>In the <em>Settings</em> panel, open the <em>Pricing
template</em> page. This page shows the list of pricing templates you have
created for your account.
</li>
<li>Choose an existing pricing template that you want to link to an in-app
product, then select the template's <em>Linked Items</em> tab. This tab shows
options to link your pricing template to in-app products and paid apps
(see figure 2).
</li>
<li>In the Link In-App Products section of the tab, enter or choose the name
of an app. This app should contain the in-app product that you want to link
to your pricing template.
</li>
<li>Based on the app that you selected, you see a list of in-app products
that are active and are not yet linked to a pricing template. Choose the
in-app product that you want to link to the pricing template by selecting the
<strong>Link</strong> button that appears in the same row as the in-app
product.
</li>
<li>The price of the in-app product is now linked to your pricing template.
Any changes you make to the prices within your pricing template affect the
prices of the linked in-app product.
</li>
</ol>
<p>
To link a pricing template to the price of a paid app, you follow a similar
process. On the pricing template's <em>Linked Items</em> tab, choose a paid
app in the Link Paid Apps section.
</p>
<figure id="fig-lpt">
<img class="border-img"
src="{@docRoot}images/in-app-billing/link_pricing_template.png" width="700"
alt="The Sleeping Potion in-app product is linked to the Basic Inventory item,
but the Invisibility Potion is not.">
<figcaption>
<b>Figure 2. </b>On a pricing template's <em>Linked Items</em> tab, you can
change which in-app products and paid apps are linked to the pricing
template.
</figcaption>
</figure>
<h4>
Linking an in-app product or paid app to a pricing template
</h4>
<p>
To link an in-app product to a pricing template, do the following:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>In the <em>All applications</em> panel, select the app name, then
open the <em>In-app Products</em> page.
</li>
<li>Choose the in-app product that you want to link to a pricing template.
The item's details page appears.
</li>
<li>In the Pricing section, choose the pricing template that you want to link
to the price of this in-app product.
</li>
<li>The price of the in-app product is now linked to the pricing template you
selected. Any changes you make to the prices within your pricing template
affect the prices of this in-app product.
</li>
</ol>
<p>
To link the price of a paid app to a pricing template, you follow a similar
process on the app's <em>Pricing &amp; Distribution</em> page.
</p>
<h3 id="delete-linked-item">
Deleting an item that is linked to a pricing template
</h3>
<p>
As your app evolves, you may find it useful to remove older versions of
in-app products or unpublish paid apps, some of which may be linked to pricing
templates. To delete an in-app product or unpublish a paid app that is linked
to a pricing template, complete the following steps. You don't need to unlink
the in-app product or paid app from the pricing template beforehand.
</p>
<h4>
Deleting an in-app product that is linked to a template
</h4>
<p>
To delete an in-app product that is linked to a template, do the following:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>Select the app that contains the in-app product you want to delete.
</li>
<li>Open the app's <em>In-app Products</em> page.
</li>
<li>Choose the in-app product that you want to delete.
</li>
<li>Select the button that indicates whether the in-app product is active or
inactive (enclosed in a box within figure 3). The drop-down menu includes a
<strong>Delete</strong> option.
</li>
<li>Select <strong>Delete</strong>, then choose <strong>Yes</strong> in the
confirmation dialog that appears.
</li>
</ol>
<figure id="fig-diap">
<img class="border-img" src="{@docRoot}images/in-app-billing/delete_iap.png"
width="500" alt="">
<figcaption>
<b>Figure 3. </b>Deleting an in-app product that is linked to a pricing
template.
</figcaption>
</figure>
<h4>
Unpublishing a paid app that is linked to a template
</h4>
<div class="figure-right">
<figure id="fig-upa">
<img src="{@docRoot}images/in-app-billing/unpublish_paid_app.png"
width="700" alt="">
<figcaption>
<b>Figure 4. </b>Unpublishing an app that has already been published and is
linked to a pricing template.
</figcaption>
</figure>
</div>
<p>
To unpublish a paid app that is already published and is linked to a template,
do the following:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>Select the app that you want to unpublish.
</li>
<li>Select <strong>Unpublish app</strong> (enclosed in a box within figure 4),
then choose <strong>Unpublish</strong> in the confirmation dialog that
appears.
</li>
</ol>
<h3 id="delete-pricing-template">
Deleting a pricing template
</h3>
<p>
If you no longer need a pricing template, you can delete it by completing the
following steps:
</p>
<ol>
<li>
<a href="http://play.google.com/apps/publish">Log in</a> to your publisher
account.
</li>
<li>In the <em>Settings</em> panel, open the <em>Pricing
template</em> page, which shows the list of pricing templates you have
created for your account.
</li>
<li>Select the pricing template that you wish to delete.
</li>
<li>On the pricing template's <em>Linked Items</em> tab, unlink all in-app
products that are linked to the template.</li>
<li>Select <strong>Delete template</strong>.
</li>
</ol>
<h2 id="billing-purchase-type">Choosing a Product Type</h2>
<p>An item's product type controls how Google Play manages the purchase of the item. The supported
product types include "managed product" and "subscription." Since support for different product
types can vary among versions of the In-app Billing API, make sure that you choose a product
type that's valid for the version of the In-app Billing API that your app uses.</p>
<p>For details, refer to the documentation for the <a
href="{@docRoot}google/play/billing/api.html#producttype">In-app Billing API</a>.</p>
<h2 id="billing-refunds">Handling Refunds</h2>
<p>In-app billing does not allow users to send a refund request to Google Play. Refunds for
in-app purchases must be directed to you (the app developer). You can then process the
refund through your Google payments merchant account. When you do this, Google Play receives a
refund notification from Google payments, and Google Play sends a refund message to your
app. For more information, see <a
href="{@docRoot}google/play/billing/v2/api.html#billing-action-notify">Handling
IN_APP_NOTIFY messages</a> and <a
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1153485">
In-app Billing Pricing</a>.</p>
<p class="caution"><strong>Important:</strong> You cannot use the API to issue
refunds or cancel In-app Billing transactions. You must do this manually through your Google
payments merchant account. However, you can use the API to retrieve order
information.</p>
<h2 id="orderId">Working with Order Numbers</h2>
<p>When a user purchases an in-app item, Google assigns the transaction
a unique and permanent order number. Google Play provides that order number to
you at the conclusion of the purchase flow, as the value of the
<code>orderId</code> field of the <code>PURCHASE_STATE_CHANGED</code>
intent.</p>
<p class="note">
<strong>Note:</strong> When a user completes a test purchase, the
<code>orderId</code> field remains blank. To track test transactions, use
the <code>purchaseToken</code> field instead. For more information about
working with test purchases, see <a
href="{@docRoot}google/play/billing/billing_testing.html">Testing In-app
Billing</a>.
</p>
<p>In your app, you can use the order number as a general-purpose identifier for
the in-app purchase transaction. After the purchase, you can use the order
number as a means of tracking the transaction in reconciliation reports and for
customer support.</p>
<p>The order number itself is a string consisting of numbers only, with a format
assigned and managed by Google.</p>
<p>For transactions dated 5 December 2012 or later, Google payments assigns a
Merchant Order Number (rather than a Google Order Number) and reports the Merchant
Order Number as the value of <code>orderID</code>. Here's an
example:</p>
<pre>"orderId" : "GPA.1234-5678-9012-34567"</pre>
<p>For transactions dated previous to 5 December 2012, Google checkout assigned
a Google Order Number and reported that number as the value of
<code>orderID</code>. Here's an example of an <code>orderID</code> holding a
Google Order Number:</p>
<pre>"orderId" : "556515565155651"</pre>
<h2 id="billing-testing-setup">Setting Up Test Accounts</h2>
<p>The Google Play Developer Console lets you set up one or more test accounts.
A test account is a regular Google account that you register on the Developer
Console as a test account. Test accounts are authorized to make in-app purchases
from apps that you have uploaded to the Google Play Developer Console
but have not yet published.</p>
<p>You can use any Google account as a test account. Test accounts are useful if you want to let
multiple people test In-app Billing on apps without giving them access to your publisher
account's sign-in credentials. If you want to own and control the test accounts, you can create the
accounts yourself and distribute the credentials to your developers or testers.</p>
<p>Test accounts have three limitations:</p>
<ul>
<li>Test account users can make purchase requests only within apps that are already
uploaded to your publisher account (although the app doesn't need to be published).</li>
<li>Test accounts can only be used to purchase items that are listed (and published) in an
app's product list.</li>
<li>Test account users do not have access to your publisher account and cannot upload apps
to your publisher account.</li>
</ul>
<p>To add test accounts to your publisher account, follow these steps:</p>
<ol>
<li><a href="http://play.google.com/apps/publish">Log in</a> to your publisher account.</li>
<li>Click the <strong>Settings</strong> icon.</li>
<li>Locate the License Testing panel.</li>
<li>Add the email addresses for the test accounts you want to register,
separating each account with a comma.</li>
<li>Click <strong>Save</strong> to save your profile changes.</li>
</ol>
<h3 id="license_key">Getting an app's license key</h3>
<p>The Google Play Developer Console provides a public licensing key for each
app.</p>
<p>To locate the key for an app, follow these steps:</p>
<ol>
<li>Open the <em>All applications</em> panel.</li>
<li>Click on the app name, then open the <em>Services &amp; APIs</em>
page.</li>
<li>Scroll down to the section of the page labeled Your License Key for This
Application, as shown in figure 5.</li>
</ol>
<p>Previously, the Developer Console provided a single public key per developer
account. To transition apps to the new per-app public key, the Developer Console
sets the app-specific key as the former developer key. This ensures compatibility
for apps that depend on the (former) developer key. </p>
<figure id="fig-bak">
<img class="border-img" src="{@docRoot}images/in-app-billing/billing_app_key.png"
width="700" alt="">
<figcaption>
<b>Figure 5. </b>You can find the license key for each app on the
<em>Services &amp; APIs</em> page.
</figcaption>
</figure>
<h2 id="billing-support">Where to Get Support</h2>
<p>If you have questions or encounter problems while implementing In-app Billing, contact the
support resources listed in the following table (see table 2). By directing your queries to the
correct forum, you can get the support you need more quickly.</p>
<p class="table-caption" id="support-table"><strong>Table 2.</strong> Developer support resources
for Google Play In-app Billing.</p>
<table>
<tr>
<th>Support Type</th>
<th>Resource</th>
<th>Range of Topics</th>
</tr>
<tr>
<td rowspan="2">Development and testing issues</td>
<td>Google Groups: <a
href="http://groups.google.com/group/android-developers">android-developers</a> </td>
<td rowspan="2">In-app billing integration questions, user experience ideas, handling of responses,
obfuscating code, IPC, test environment setup.</td>
</tr>
<tr>
<td>Stack Overflow: <a
href="http://stackoverflow.com/questions/tagged/android">http://stackoverflow.com/questions/tagged/
android</a></td>
</tr>
<tr>
<td>Billing issue tracker</td>
<td><a href="http://code.google.com/p/marketbilling/issues/">Billing
project issue tracker</a></td>
<td>Bug and issue reports related specifically to In-app Billing sample code.</td>
</tr>
</table>
<p>For general information about how to post to the groups listed above, see <a
href="{@docRoot}resources/community-groups.html">Developer Forums</a> document in the Resources
tab.</p>