Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c22f151 authored by Andrew Solovay's avatar Andrew Solovay Committed by Android (Google) Code Review
Browse files

Merge "docs: In-App Billing HTML formatting cleanup" into mnc-docs

parents 37d6faf2 8e34a805
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -130,9 +130,10 @@ number of in-app items.</p>
    a product ID.</p>
  </li>
  <li><strong>Product Type</strong>
    <p>The product type can be <strong>Managed per user account</strong>, <strong>Unmanaged</strong>,
    or <strong>Subscription</strong>. You can never change an item's product type after you set it. For more
    information, see <a href="#billing-purchase-type">Choosing a product type</a> later in this
    <p>The product type can be <strong>Managed per user account</strong>,
    <strong>Unmanaged</strong>, or <strong>Subscription</strong>. You can never
    change an item's product type after you set it. For more information, see
    <a href="#billing-purchase-type">Choosing a product type</a> later in this
    document.</p>
  </li>
  <li><strong>Publishing State</strong>
@@ -161,7 +162,8 @@ number of in-app items.</p>
  </li>
  <li><strong>Description</strong>
    <p>The description is a long descriptor for the item. For example, "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.</p>
    sleep. Does not work on angry elves." Every item must have a description. Descriptions can be
    up to 80 characters in length.</p>
  </li>
  <li><strong>Price</strong>
    <p>You must provide a default price in your home currency. You can also provide prices in other
@@ -171,22 +173,25 @@ number of in-app items.</p>
    <p>To specify prices in other currencies, you can manually enter the price for each
    currency or you can click <strong>Auto Fill</strong> and let Google Play do a one-time
    conversion from your home currency to the currencies you are targeting (see figure 3).</p>
    <p>For subscription items, note that you can not change the item's price once you have published it. </p>
    <p>For subscription items, note that you can not change the item's price once you have published
    it.</p>
  </li>
</ul>

<div style="margin:1em;">
<img style="border:1px solid #ddd;padding-bottom:.5em" src="{@docRoot}images/in-app-billing/billing_list_form_2.png" xheight="1226" id="figure3" />
<img style="border:1px solid #ddd;padding-bottom:.5em"
    src="{@docRoot}images/in-app-billing/billing_list_form_2.png"
    xheight="1226" id="figure3" />
<p class="img-caption" style="padding-left:.5em;">
  <strong>Figure 3.</strong> Specifying additional currencies for an in-app product.
</p>
</div>

<p>For more information about product IDs and product lists, see <a
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1072599">Creating In-App Product
IDs</a>. For more information about pricing, see <a
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1153485">In-App Billing
Pricing</a>.</p>
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1072599">
Creating In-App Product IDs</a>. For more information about pricing, see <a
href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=1153485">
In-App Billing Pricing</a>.</p>

<p class="note"><strong>Note</strong>: Be sure to plan your product ID namespace. You cannot reuse
or modify product IDs after you save them.</p>
@@ -203,7 +208,8 @@ keep tax-inclusive pricing in mind. If you use auto-fill, you can provide a
tax-exclusive default price and tax-inclusive prices will be auto-filled. If you
do not use auto-fill, prices you provide must include tax.</p>

<p class="note"><strong>Note:</strong> Batch upload of product lists containing subscriptions is not yet supported.</p>
<p class="note"><strong>Note:</strong> Batch upload of product lists containing
subscriptions is not yet supported.</p>

The CSV file uses commas (,) and semi-colons (;) to separate data values.
Commas are used to separate primary data values, and semi-colons are used to separate subvalues. For
@@ -287,7 +293,8 @@ example, the syntax for the CSV file is as follows:</p>
  </li>
  <li><em>price</em>
    <p>This is equivalent to the Price in the In-app Products UI. The price must be specified in
    micro-units. To convert a currency value to micro-units, you multiply the real value by 1,000,000.
    micro-units. To convert a currency value to micro-units, you multiply the real value by
    1,000,000.
    For example, if you want to sell an in-app item for $1.99 you specify 1990000 in the
    <em>price</em> field.</p>
  </li>
@@ -413,8 +420,8 @@ refund notification from Google payments, and Google Play sends a refund message
application. 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>
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
@@ -453,10 +460,11 @@ Google Order Number:</p>

<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 applications that you have uploaded to the Google Play
Developer Console but have not yet published.</p>
<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 applications 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 applications without giving them access to your publisher
@@ -547,6 +555,3 @@ project issue tracker</a></td>
<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>


+18 −8
Original line number Diff line number Diff line
@@ -90,16 +90,27 @@ replay attacks.</p>
nonces on the server.</p>

<h3 id="payload">Set the developer payload string when making purchase requests</h3>
<p>With the In-app Billing Version 3 API, you can include a 'developer payload' string token when sending your purchase request to Google Play. Typically, this is used to pass in a string token that uniquely identifies this purchase request. If you specify a string value, Google Play returns this string along with the purchase response. Subsequently, when you make queries about this purchase, Google Play returns this string together with the purchase details.</p>
<p>You should pass in a string token that helps your application to identify the user who made the purchase, so that you can later verify that this is a legitimate purchase by that user. For consumable items, you can use a randomly generated string, but for non-consumable items you should use a string that uniquely identifies the user.</p>
<p>When you get back the response from Google Play, make sure to verify that the developer payload string matches the token that you sent previously with the purchase request. As a further security precaution, you should perform the verification on your own secure server.</p>
<p>With the In-app Billing Version 3 API, you can include a 'developer payload'
string token when sending your purchase request to Google Play. Typically, this
is used to pass in a string token that uniquely identifies this purchase request.
If you specify a string value, Google Play returns this string along with the
purchase response. Subsequently, when you make queries about this purchase,
Google Play returns this string together with the purchase details.</p>
<p>You should pass in a string token that helps your application to identify the user who
made the purchase, so that you can later verify that this is a legitimate purchase by
that user. For consumable items, you can use a randomly generated string, but for non-
consumable items you should use a string that uniquely identifies the user.</p>
<p>When you get back the response from Google Play, make sure to verify that the
developer payload string matches the token that you sent previously with the purchase
request. As a further security precaution, you should perform the verification on your
own secure server.</p>


<h3 id="trademark">Take action against trademark and copyright infringement</h3>
<p>If you see your content being redistributed on Google Play, act quickly and decisively. File a
<a href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=141511">trademark notice
of infringement</a> or a <a href="http://www.google.com/android_dmca.html">copyright notice of
infringement</a>.</p>
<a href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=141511">
trademark notice of infringement</a> or a <a href="http://www.google.com/android_dmca.html">
copyright notice of infringement</a>.</p>

<h3 id="revocable">Implement a revocability scheme for unlocked content</h3>
<p>If you are using a remote server to deliver or manage content, have your application verify the
@@ -112,4 +123,3 @@ literal string. Instead, construct the string at runtime from pieces or use bit
example, XOR with some other string) to hide the actual key. The key itself is not secret
information, but you do not want to make it easy for a hacker or malicious user to replace the
public key with another key.</p>
+10 −3
Original line number Diff line number Diff line
@@ -222,9 +222,11 @@ ServiceConnection mServiceConn = new ServiceConnection() {
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
  Intent serviceIntent =
      new Intent("com.android.vending.billing.InAppBillingService.BIND");
  serviceIntent.setPackage("com.android.vending");
  bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
}
</pre>

<p>
@@ -509,7 +511,11 @@ Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
  products that are owned by the user has been sent to your app.
</p>

<p>For more information about the data returned by {@code getPurchases}, see <a href="{@docRoot}google/play/billing/billing_reference.html#getPurchases">In-app Billing Reference</a>. The following example shows how you can retrieve this data from the response.</p>
<p>For more information about the data returned by {@code getPurchases}, see
  <a href="{@docRoot}google/play/billing/billing_reference.html#getPurchases">
  In-app Billing Reference</a>. The following example shows how you can
  retrieve this data from the response.
</p>

<pre>
int response = ownedItems.getInt("RESPONSE_CODE");
@@ -656,4 +662,5 @@ to a secure remote server then we recommend that you perform the signature
verification on that server.</p>

<p>For more information about best practices for security and design, see <a
href="{@docRoot}google/play/billing/billing_best_practices.html">Security and Design</a>.</p>
href="{@docRoot}google/play/billing/billing_best_practices.html">Security and
Design</a>.</p>
+16 −13
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ same look-and-feel as for app purchases.</li>
  </ol>
   <h2>Related Samples</h2>
  <ol>
    <li><a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">Sample Application (V3)</a></li>
    <li><a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">Sample
      Application (V3)</a></li>
  </ol>
</div>
</div>
@@ -40,12 +41,13 @@ Billing features into your application.</p>

<p class="note"><b>Note</b>: Ensure that you comply with applicable laws in the countries where you
distribute apps. For example, in EU countries, laws based on the
<a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2005:149:0022:0039:EN:PDF">Unfair
Commercial Practices Directive</a> prohibit direct exhortations to children to buy advertised
<a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2005:149:0022:0039:EN:PDF">
Unfair Commercial Practices Directive</a> prohibit direct exhortations to children to buy advertised
products or to persuade their parents or other adults to buy advertised products for them.
See the
<a href="http://ec.europa.eu/consumers/enforcement/docs/common_position_on_online_games_en.pdf">position
of the EU consumer protection authorities</a> for more information on this and other topics.
<a href="http://ec.europa.eu/consumers/enforcement/docs/common_position_on_online_games_en.pdf">
position of the EU consumer protection authorities</a> for more information on this and other
topics.
</p>

<h2 id="api">In-app Billing API</h2>
@@ -65,7 +67,9 @@ must be able to access the Google Play server over the network.</p>
<p>In-app billing Version 3 is the latest version, and maintains very broad
compatibility across the range of Android devices. In-app Billing Version 3 is
supported on devices running Android 2.2 or higher that have the latest version
of the Google Play store installed (<a href="{@docRoot}about/dashboards/index.html">a vast majority</a> of active devices).</p>
of the Google Play store installed (<a
href="{@docRoot}about/dashboards/index.html">a vast majority</a> of active
devices).</p>

<h4>Version 3 features</h4>
<ul>
@@ -107,7 +111,9 @@ the Google Play Developer Console.</p>
<p>You can specify these types of products for your In-app Billing application
— <em>managed in-app products</em> and <em>subscriptions</em>. Google Play
handles and tracks ownership for in-app products and subscriptions on your
application on a per user account basis. <a href="{@docRoot}google/play/billing/api.html#producttypes">Learn more about the product types supported by In-app Billing Version 3</a>.</p>
application on a per user account basis.
<a href="{@docRoot}google/play/billing/api.html#producttypes">Learn more about
the product types supported by In-app Billing Version 3</a>.</p>

<h2 id="console">Google Play Developer Console</h2>
<p>The Developer Console is where you can publish your
@@ -146,7 +152,9 @@ Google Play.</p>
provides a sample application that demonstrates how to sell in-app products and subscriptions
from inside an app.</p>

<p>The <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">TrivialDrive sample for the Version 3 API</a> sample shows how to use the In-app Billing Version 3 API
<p>The <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">
TrivialDrive sample for the Version 3 API</a> sample shows how to use the In-app
Billing Version 3 API
to implement in-app product and subscription purchases for a driving game. The
application demonstrates how to send In-app Billing requests, and handle
synchronous responses from Google Play. The application also shows how to record
@@ -175,8 +183,3 @@ the Version 3 API. You do not need to create a new product entry in Developer
Console for these items, and you can use the same product IDs to purchase these
items.
</ul>




+39 −12
Original line number Diff line number Diff line
@@ -29,11 +29,17 @@ parent.link=index.html
  </ol>
</div>
</div>
<p>This documentation provides technical reference information for using the In-app Billing Version 3 API. </p>
<p>This documentation provides technical reference information for using the
In-app Billing Version 3 API. </p>

<h2 id="billing-codes">Server Response Codes</h2>
<p>The following table lists all of the server response codes that are sent from Google Play to your application. Google Play sends the response code synchronously as an integer mapped to the {@code RESPONSE_CODE} key in the response {@code Bundle}. Your application must handle all of these response codes.</p>

<p>
  The following table lists all of the server response codes that are sent from
  Google Play to your application. Google Play sends the response code
  synchronously as an integer mapped to the {@code RESPONSE_CODE} key in the
  response {@code Bundle}. Your application must handle all of these response
  codes.
</p>
<p class="table-caption" id="response-codes-table">
<strong>Table 1.</strong> Summary of response codes for In-app Billing Version 3 API calls.</p>
<table>
@@ -70,7 +76,10 @@ parent.link=index.html
  <tr>
    <td>{@code BILLING_RESPONSE_RESULT_DEVELOPER_ERROR}</td>
    <td>5</td>
    <td>Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest</td>
    <td>Invalid arguments provided to the API. This error can also indicate that
    the application was not correctly signed or properly set up for In-app
    Billing in Google Play, or does not have the necessary permissions in its
    manifest</td>
  </tr>
  <tr>
    <td>{@code BILLING_RESPONSE_RESULT_ERROR}</td>
@@ -90,13 +99,23 @@ parent.link=index.html
</table>

<h2 id="billing-interface">API Reference</h2>
<p>The In-app Billing Version 3 API is defined in the {@code IInAppBillingService.aidl} file, which is included with the Version 3 <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">sample application</a>.</p>
<p>The In-app Billing Version 3 API is defined in the {@code
  IInAppBillingService.aidl} file, which is included with the Version 3
  <a href="{@docRoot}training/in-app-billing/preparing-iab-app.html#GetSample">
  sample application</a>.</p>

<h3 id="getSkuDetails">The getSkuDetails() method</h3>
<p>This method returns product details for a list of product IDs. In the response {@code Bundle} sent by Google Play, the query results are stored in a String {@code ArrayList} mapped to the {@code DETAILS_LIST} key. Each String in the details list contains product details for a single product in JSON format. The fields in the JSON string with the product details are summarized in table 2.</p>

<p>
  This method returns product details for a list of product IDs. In the
  response {@code Bundle} sent by Google Play, the query results are stored in
  a String {@code ArrayList} mapped to the {@code DETAILS_LIST} key. Each
  String in the details list contains product details for a single product in
  JSON format. The fields in the JSON string with the product details are
  summarized in table 2.
</p>
<p class="table-caption" id="product-details-table">
<strong>Table 2.</strong> Description of JSON fields with product item details returned from a {@code getSkuDetails} request.</p>
<strong>Table 2.</strong> Description of JSON fields with product item details
returned from a {@code getSkuDetails} request.</p>
<table>
  <tr>
    <th scope="col">Key</th>
@@ -179,7 +198,8 @@ RSASSA-PKCS1-v1_5 scheme.</td>
</table>
</p>

<p>Table 4 describes the JSON fields that are returned in the response data for a purchase order.</p>
<p>Table 4 describes the JSON fields that are returned in the response data for
a purchase order.</p>
<p class="table-caption" id="purchase-data-table">
<strong>Table 4.</strong>  Descriptions of the JSON fields for {@code INAPP_PURCHASE_DATA}.</p>
<table>
@@ -216,7 +236,9 @@ RSASSA-PKCS1-v1_5 scheme.</td>
  </tr>
  <tr>
    <td>{@code productId}</td>
    <td>The item's product identifier. Every item has a product ID, which you must specify in the application's product list on the Google Play Developer Console.</td>
    <td>The item's product identifier. Every item has a product ID, which you
      must specify in the application's product list on the Google Play
      Developer Console.</td>
  </tr>
  <tr>
    <td>{@code purchaseTime}</td>
@@ -330,8 +352,13 @@ subscriptions.</p>
  </tr>
  <tr>
    <td>{@code INAPP_CONTINUATION_TOKEN}</td>
    <td>String containing a continuation token to retrieve the next set of in-app products owned by the user. This is only set by the Google Play service if the number of products owned by the user is very large. When a continuation token is present in the response, you must make another call to {@code getPurchases} and pass in the continuation token that you received. The subsequent {@code getPurchases} call returns more purchases and possibly another continuation token.</td>
    <td>String containing a continuation token to retrieve the next set of
      in-app products owned by the user. This is only set by the Google Play
      service if the number of products owned by the user is very large. When a
      continuation token is present in the response, you must make another call
      to {@code getPurchases} and pass in the continuation token that you
      received. The subsequent {@code getPurchases} call returns more purchases
      and possibly another continuation token.</td>
  </tr>
</table>
</p>
Loading