Developer Console

Install and Configure the App Tester

App Tester allows you to unit test the In-App Purchasing (IAP) functionality of your app in sandbox mode before you submit the app for publication.

You download App Tester from the Amazon Appstore onto the same Android device as your app. The App Tester simulates the production environment.

You run IAP-related test cases on your app, and App Tester generates API responses (that you configure using a JSON file).

App Tester Prerequisites

Your development and testing environment must meet the following prerequisites to run test cases with App Tester:

  • Your development environment allows logging via ADB and logcat
  • An Android device that supports SDK version 10 or later
  • Your app implements Appstore SDK API method calls
  • No SDK Tester on the device. SDK Tester is not compatible with App Tester or with the Appstore SDK.

Note: If your app targets Android OS 5.0 (Lollipop), ensure that you download the App Tester tool version that is later than 3-Dec-2014.

We recommend that you create one or more purchasable items for your app in the Amazon Appstore. This allows you to easily create the required JSON file.

Install 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

You can also install the App Tester 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.

Create a JSON Data File

The App Tester responds to API calls using data stored in a JavaScript Object Notation (JSON) file. The file contains purchase data for the IAP items.

You can automatically create the JSON file through the Apps & Games Developer Portal.

  1. In a web browser, go to the your app's page on the Apps & Games Developer Portal.
  2. Add your IAP 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 the /sdcard/ folder in your device file system.

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

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. Every purchasable item is associated with a unique identifier called a SKU.

"your_item_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".

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

An example of a subscription item description follows below (note the subscription parent SKU).

{
  "com.amazon.sample.iap.subscription.mymagazine.silver": {
      "description": "Monthly Subscription to My Magazine Silver",
      "title": "Silver month",
      "itemType": "SUBSCRIPTION",
      "price": 50.0,
      "subscriptionBase": "com.amazon.subs.base",
      "subscriptionParent": "com.amazon.subs.silver",
      "term": "Monthly",
      "freeTrialPeriod": "Monthly",
      "promotions": [
          {
              "promotionType": "Introductory",
              "promotionPlans": [
                  {
                      "promotionPrice": 15,
                      "promotionPricePeriod": "Monthly",
                      "promotionPriceCycles": 2
                  },
                  {
                      "promotionPrice": 20,
                      "promotionPricePeriod": "Monthly",
                      "promotionPriceCycles": 1
                  }
              ]
          }
      ]
  },
  "com.amazon.sample.iap.subscription.mymagazine.gold": {
      "description": "Monthly Subscription to My Magazine Gold",
      "title": "Gold month",
      "itemType": "SUBSCRIPTION",
      "price": 80.0,
      "term": "Monthly",
      "subscriptionBase": "com.amazon.subs.base",
      "subscriptionParent": "com.amazon.subs.gold"
  }
}

Verify Your IAP Items

You can easily review the contents of the JSON file. From the App Tester main menu, tap the IAP Items in JSON File option to display a human-readable list of the item data in the JSON file.

Next Steps

Familiarize yourself with the App Tester tool and the test options for IAP:

  1. Read the App Tester User Guide to learn how to use this tool.
  2. See Design and Run Test Cases for IAP for ideas on how to test your IAP functionality.

Last updated: Jun 06, 2023