Home > Services & APIs > Earn > In-App Purchasing

Installing and Configuring the App Tester

Introduction

Introduction

Available from the Amazon Appstore, the App Tester allows you to test the In-App Purchasing (IAP) functionality of your app locally before submitting it for publication. The App Tester simulates a production environment where you can construct test cases that cover the responses generated by the Amazon APIs. Because only apps that have been approved and published through the Amazon Apps & Games Developer Portal can communicate with the Amazon Appstore, you will need to use the App Tester to see how your apps run in a live environment before you submit them.

App Tester Requirements

The App Tester tool has the following requirements:

General Requirements

Your development and testing environment should meet the following requirements to be able to execute test cases with App Tester:

  • Android development environment that allows logging via ADB and logcat
  • Android device supporting SDK version 10 or later
  • Android app that implements the IAP v2.0 API
  • SDK Tester uninstalled, if you previously installed SDK Tester for IAP v1.0.
  • One or more purchasable items created for your app in the Amazon Appstore (optional but recommended).

As discussed on this page, you will also need to install the App Tester app to an Android mobile device and create a JSON data file for testing.

Note: App Tester is not supported for IAP v1.0 and is incompatible with the SDK Tester tool included in the download for IAP v1.0.

Android OS 5.0 (Lollipop) Requirements

If your app is targeting Android OS 5.0 (Lollipop), and you downloaded the App Tester tool before 3-Dec-2014, this version of the App Tester is not compatible with Android OS 5.0. On 3-Dec-2014, Amazon published a version of the App Tester with an updated signature to be compatible with Android OS 5.0.

Note: This version of App Tester is compatible with the FireTv Stick.

To use the App Tester with Android OS 5.0:

  1. Uninstall your old version of App Tester from your mobile device.
  2. Download a new copy of the app.
  3. Install the updated version of App Tester to your mobile device.

Installing App Tester

The App Tester is a free app that runs on Android mobile devices. Download App Tester from the Amazon Appstore:

  1. Uninstall any versions of the SDK Tester tool that you used to test IAP v1.0.
  2. Download the App Tester

Alternately, you can install the app directly from the Amazon Appstore to your Android mobile device:

  1. Uninstall any versions of the SDK Tester tool that you used to test IAP v1.0.
  2. On your Android mobile device, start the Amazon Appstore app.
  3. Search for “Amazon App Tester”.
  4. Select the “Amazon App Tester” app. (Do not select the Web App Tester, which is a different app.)
  5. Tap through the prompts to download and install the app.

Obtaining a JSON Data File

The App Tester uses a JavaScript Object Notation (JSON) text file that contains the IAP item or Mobile Associates purchase data used to respond to API calls. You can automatically create this file through the Apps & Games Developer Portal.

To obtain your JSON file via download from the Apps & Games Developer Portal:

  1. In your web browser, go to the your app’s page on the Apps & Games Developer Portal.
  2. Add your IAP or Mobile Associates purchasable items to your app, if you have not already done so.
  3. Click the link to download your JSON Data File.
  4. Name the downloaded file “amazon.sdktester.json”.
  5. Copy the file to /mnt/sdcard/ folder in your device file system.

    $ adb push [_Your_JSON_File_Folder_]/amazon.sdktester.json /mnt/sdcard/

If you open the downloaded JSON file, note that the general file format is as follows:

 {
  Item_ID_1:{Item_1_Description},
  Item_ID_2:{Item_2_Description},
  .
  .
  .
  Item_ID_n:{Item_n_Description}
  }							

The actual item description definition varies by item type. The order of the items in the JSON file is not significant. Note the comma “,” between description definitions.

File Format and Example: IAP Consumable and Entitlement Items

Consumable and Entitlement IAP Item Descriptions have the same format. The itemType property indicates whether the item is ENTITLED or CONSUMABLE.

"SKU":{
  "itemType": "ENTITLED|CONSUMABLE",
  "price": price,
  "title": "item_title",
  "description": "item_description",
  "smallIconUrl": "full_url_for_small_icon",
  }

The following example shows a consumable and an entitlement item:

   {
    "com.amazon.sample.iap.consumables.orange" : {
    "itemType": "CONSUMABLE",
    "price": 10.00,
    "title": "Orange",
    "description": "An orange"
    "smallIconUrl": "http://www.amazon.com/orange.jpg"
    },

  "com.amazon.sample.iap.entitlements.level2" : {
    "itemType": "ENTITLED",
    "price": 10.00,
    "title": "Level 2",
    "description": "An entitlement to play level 2"
  }
}

File Format and Example: IAP Subscription Item

Subscription items are different from other types of items you can purchase. Every purchasable item is associated with an identifier called a SKU that identifies it as unique. When a subscription is purchased, there are two SKUs involved. One, the “parent SKU”, describes what the subscription is for (such as a magazine title). The other SKU is the “terms SKU”, which describes the terms (price, length) of the subscription. The terms SKU is what actually gets purchased by a customer.

Since the terms SKU is the purchasable item, the JSON IAP Item Description is for that item. However, the description must also contain a reference to the Parent SKU. Therefore, subscription item types include an additional property: “subscriptionParent”.

"SKU":{
    "itemType": "SUBSCRIPTION",
    "price": price,
    "title": item_title,
    "description": item_description,
    "smallIconUrl": "http://www.amazon.com/kindle.jpg",
    "subscriptionParent": "parentSKU"
  }

An example of a subscription item description from the IAP Subscription Sample app follows below (note the subscription parent SKU).

  {
    "com.amazon.sample.iap.subscriptions.mymagazine.month":
    {
      "description":"Monthly Subscription to My Magazine",
      "title":"My Magazine",
      "itemType":"SUBSCRIPTION",
      "price":5.0,
      "subscriptionParent":"com.amazon.sample.iap.subscriptions.mymagazine"
    }
  }

Verifying Your IAP Items

Once you have your App Tester app working, you can easily verify the IAP items that you included in your JSON file. Within the app, from the main menu, tap the IAP Items in JSON File option to display a human-readable list of the item data in your JSON file.

Next Steps

If you have not already done so, familiarize yourself with the testing tools and options for IAP:

  1. Read Testing In-App Purchasing (IAP) to learn about the available testing tools and recommended testing process for IAP.

  2. Now that you have installed the App Tester, read the App Tester User Guide to learn how to use this tool.
  3. If you need help setting up test cases and determining what settings to use in executing those test cases with the App Tester, see Designing and Executing Test Cases for IAP.