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

Testing your Amazon In-App Purchasing App with Adobe AIR (IAP v1.0)

IAP v1.0 Deprecation Notice

In July 2014, Amazon released the In-App Purchasing (IAP) v2.0 API, which includes several important updates. As of April 30, 2016, Amazon will deprecate IAP v1.0 for new and updated app submissions. While this deprecation will not affect apps that are currently live in the Amazon Appstore, any apps submitted as either a new or updated app after May 11, 2016 will need to use IAP v2.0.

Create and Install the Item List JSON File

In order to test your In-App Purchasing before submitting to the app store, you'll need to create a special file in the JSON format that contains all the metadata for your purchases. While in sandbox mode, this file will determine how the app responds to purchase requests.

The following example shows the format this file should take, with a consumable item with a sku 'my_spell' and a an entitlement item 'my_levelpack' as an example. You should be sure that the SKUs, titles, descriptions, and other data match what you entered into the Amazon Apps & Games Developer Portal in step 1, in order to ensure that your local testing is accurate.

The file should be named amazon.sdktester.json . In the /examplefolder of the extension package, you can find a reference example of this file.

You can also find more detailed information on the file format at https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html#Create JSON.

  1. Create a file called amazon.sdktester.json in your favorite text editor, using the following example as a guide. Use the SKUs and other information for your own purchases, and save the file:
  2. {
        "my_spell" : {
            "itemType": "CONSUMABLE",
            "price": 0.99,
            "title": "Consumable Spell",
            "description": "It's a spell",
            "smallIconUrl": "http://some/image.jpg"
        },
        "my_levelpack" : {
            "itemType": "ENTITLED",
            "price": 0.99,
            "title": "Level Pack 1",
            "description": "More levels for this game!",
            "smallIconUrl": "http://some/image.jpg"
        }
    }
    
  3. Save the file to a location on your computer.
  4. Plug your device into the USB port on your computer.
  5. Open a Command Prompt on Windows (Start:Run, type cmdand press Enter)or the Terminal on a Mac (Applications:Terminal).
  6. Navigate to the location of the JSON file. On Windows, if the file was saved in C:\dev\, you'd enter the command:
    cd c:\dev
    
    ...and press Enter. On a Mac, if the file was saved in /yourusername/dev, you'd type:
    cd /Users/yourusername/dev
    
    and press Return.
  7. Run the adbprogram that's included with the Android SDK. (If you don't have the SDK, you can get it at http://developer.android.com/sdk/index.html). You'll be running the pushcommand and passing the location of the json file as the first parameter, and /mnt/sdcard as the second parameter.

    On Windows, if the Android SDK was located at C:\dev\android-sdk, you'd type:

  8. c:\dev\android-sdk\platform-tools\adb push amazon.sdktester.json /mnt/sdcard
    
    ...and press Enter. On a Mac, if the Android SDK was located in /Users/yourusername/android-sdk, you'd type:
    ./Users/yourusername/android-sdk/platform-tools/adb push amazon.sdktester.json /mnt/sdcard
    
    ...and press Return.

Install the Amazon SDK Tester Application

In order to test Amazon In-App Purchasing locally, you also must install a special test application called the Amazon SDK Tester. The App is included in the Amazon SDK which can be downloaded from https://developer.amazon.com/sdk.html.

To install the app, you'll again use the adb command from the Android SDK:

  1. Plug your device into the USB port on your computer.
  2. Open a Command Prompt on Windows (Start:Run, type 'cmd' and press Enter)or the Terminal on a Mac (Applications:Terminal).
  3. Navigate to the location of the Amazon SDK tools. On Windows, if the SDK was saved in C:\dev\In-App-Purchasing, you'd enter the command:
    cd c:\dev\In-App-Purchasing\tools
    
    ...and press Enter. On a Mac, if the file was saved in /yourusername/dev/In-App-Purchasing, you'd type:
    cd /Users/yourusername/dev/In-App-Purchasing/tools
    
    and press Return.
  4. Run the adbprogram that's included with the Android SDK. You'll be running the install command and passing the SDK tester app APK as a paremeter. On Windows, if the Android SDK was located at C:\dev\android-sdk, you'd type:
    c:\dev\android-sdk\platform-tools\adb install -r AmazonSDKTester.apk
    
    ...and press Enter. On a Mac, if the Android SDK was located /Users/yourusername/android-sdk, you'd type:
    ./Users/yourusername/android-sdk/platform-tools/adb install -r AmazonSDKTester.apk
    
    ...and press Return.