• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Testing Your In-app Billing Application
2parent.title=Selling In-app Products
3parent.link=index.html
4
5trainingnavtop=true
6previous.title=Purchasing In-app Billing Products
7previous.link=purchase-iab-products.html
8
9@jd:body
10
11<div id="tb-wrapper">
12<div id="tb">
13
14<h2>This lesson teaches you to</h2>
15<ol>
16  <li><a href="#StaticTest">Test with Static Responses</a></li>
17  <li><a href="#PlayItemTest">Test with Your Own Product IDs</a></li>
18</ol>
19
20<h2>You should also read</h2>
21<ul>
22<li><a href="{@docRoot}google/play/billing/billing_testing.html">Testing In-app Billing</a></li>
23</ul>
24
25</div>
26</div>
27
28<p>To ensure that In-app Billing is functioning correctly in your application, you should test the test the application before you publish it on Google Play. Early testing also helps to ensure that the user flow for purchasing in-app items is not confusing or slow, and that users can see their newly purchased items in a timely way.</p>
29
30<h2 id="StaticTest">Test with Static Responses</h2>
31Test your In-app Billing application with static responses by using Google Play’s reserved product IDs.By using  reserved product IDs instead of actual product IDs, you can test the purchase flow without specifying an actual payment method or transferring money. To learn more about the reserved product IDs, see <a href="{@docRoot}google/play/billing/billing_testing.html">Testing In-app Billing</a>.
32
33<h2 id="PlayItemTest">Test with Your Own Product IDs</h2>
34<p>Because Google Play does not allow you to use your developer account to directly purchase in-app products that you have created yourself, you'll need to create test acccounts under your developer account profile. To create a test account, simply enter a valid Google email address. Users with these test accounts will then be able to make in-app-billing purchases from uploaded, unpublished applications that you manage.</p>
35<p>To test your In-app Billing Version 3 application using your own product IDs:
36<ol>
37<li>In the Developer Console, add one or more tester accounts to the developer account that you are using to publish your application.
38  <ol type="a">
39  <li>Login to the <a href="https://play.google.com/apps/publish/" target="_blank">Developer Console</a> with your developer account.</li>
40  <li>Click <strong>Settings</strong> > <strong>Account</strong> details, then in the <strong>License Testing</strong> section, add the Google email addresses for your tester accounts.</li>
41</ol>
42<li>Build a signed APK file for your In-app Billing application. To learn how to build and sign your APK, see <a href="{@docRoot}tools/publishing/preparing.html#publishing-build">Building Your Application for Release</a>. Make sure that you are using your final (not debug) certificate and private key to sign your application.
43</li>
44<li>Make sure that you have uploaded the signed APK for your application to the Developer Console, and associated one or more in-app products with your application. You don't need to publish the application on Google Play to test it. <p class="note"><strong>Warning:</strong> It may take up to 2-3 hours after uploading the APK for Google Play to recognize your updated APK version. If you try to test your application before your uploaded APK is recognized by Google Play, your application will receive a ‘purchase cancelled’ response with an error message “This version of the application is not enabled for In-app Billing.”</p></li>
45<li>Install the APK file to your physical test device by using the {@code adb} tool. To learn how to install the application, see <a href="{@docRoot}tools/building/building-cmdline.html#RunningOnDevice">Running on a Device</a>. Make sure that:
46   <ul>
47   <li>Your test device is running on Android SDK Version 2.2 (API level 8) or higher, and is installed with Google Play client Version 3.9.16 or higher.</li>
48   <li>The {@code android:versionCode} and {@code android:versionName} attributes values in the {@code AndroidManifest.xml} of the application that you are installing matches the values of your APK in the Developer Console.</li>
49   <li>Your application is signed with the same certificate that you used for the APK that you uploaded to the Developer Console, before installing it on your device.</li>
50   </ul>
51</li>
52<li>Login to the test device by using a tester account. Test your In-app
53Billing application by purchasing a few items, and fix any issues that you
54encounter. To learn more about how you can perform large-scale testing of your
55In-app Billing app, see <a href="{@docRoot}google/play/billing/billing_testing.html#test-purchases}">Test Purchases (In-app Billing Sandbox)</a>.
56</li>
57</ol>
58</p>
59
60