Edit the Blog Post Header component above this, then place your content here, then fill out the Related Articles section below, if possible. You should have at least one related article and ideally, all three.
Feel free to add supplementary content to the sidebar at right, but please retain the Twitter component (it can live at the bottom of your added content).
This text component can be edited or deleted as necessary.
Related articles only have an image (the squarer version of the banner) and a title. This text can be deleted. Place 1-3 related articles.
Testing in-app purchase (IAP) items in your app is vital. That's why you need a way to make it part of an efficient dev workflow, and start testing it right away as you’re developing your app.
DevTest for IAP makes this possible by letting you test locally against live Amazon services without publishing your app or even submitting a beta version. It lets you test your purchase logic immediately and iterate quickly, so you can show up to beta testing (via Live App Test) with confidence that your IAP stuff works.
How is DevTest different from App Tester and Live App Testing?
App Tester just simulates mock responses. DevTest connects to Amazon's actual services, so you're testing the real thing.
Live App Testing requires your app to be published (as a beta) first. DevTest doesn't. You can test your code right after writing it.
Let's walk through setting up DevTest with a simple fictional app, so you can start using DevTest in your own projects.
"Guess the Number" is a game app where you try to identify a random number between 1 and 100 within five attempts. After each guess, the game indicates whether the secret number is "higher" or "lower" than your guess.
This game has three IAP items (one for each type):
To ensure the app's subscription tracking, consumable extra guesses, and hints entitlement work correctly, we need to test them against Amazon's live services. DevTest lets us validate these purchase flows immediately without waiting for app approval.
If you don't already have a certificate, generate one locally using the following command:
$ openssl req -x509 -nodes \
-newkey ec \
-pkeyopt ec_paramgen_curve:secp384r1 \
-keyout key.pem -out cert.pem
This creates two files: key.pem (your private key) and cert.pem (your certificate). Keep both of these files safe, as you'll need them for app registration and signing.
In the Amazon Developer Console, create your app (if you haven't already). Then, navigate to Amazon Appstore DevTest for IAP.
Copy and paste the contents of your cert.pem file into the certificate field. Enter the package name for your application, which can be found in your project's build.gradle file. Click Register.
The registration process for your app may take several minutes. Once it is complete, reloading this page will show the following:
You can add up to multiple certificates for your app. This allows you to build and sign your APK with different certificates (up to three).
If you have already added IAP items for your app, you can skip this step. Otherwise, navigate to In-App Items to add your subscription, consumables, and entitlements.
You must submit each of your IAP items before you can test them.
Under Amazon Appstore DevTest for IAP, navigate to Manage Testers.
Add test accounts so you (and other testers) can make purchases without getting charged. You can add up to 50 testers who will be able to test purchases on their devices.
Generate a signed APK, using the same certificate you used for DevTest registration.
Create a keystore from your certificate.
$ openssl pkcs12 -export -out keystore.p12 -inkey key.pem -in cert.pem
If you're using Android Studio, navigate to Generate Signed App bundle or APK.
Select APK.
Use the keystore file you just created to sign your app. If you are prompted for the key alias, it is likely "1". However, you can verify this by running the following command in your terminal:
$ keytool -v -list -keystore keystore.p12
Enter keystore password:
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: 1
…
After your build is complete, you'll have a signed APK which you can sideload onto any test device. Because the app is signed with the certificate used to register your app with DevTest, any calls made to the Appstore SDK API will be routed to Amazon's test servers.
Now you're ready to test purchases.
Install your signed APK on your test device. Follow the instructions for using adb to connect to your Fire Tablet or connect to Fire TV.
Using the file that corresponds to your signed APK, run the following command:
$ adb install app-release.apk
Performing Streamed Install
Success
After installing the app, sync your device with Amazon's servers so the device knows about the IAP items that have been added.
On your testing device, navigate to Settings > Device Options > Sync Device.
While testing your app with DevTest, use adb logcat to show you what's happening behind the scenes. With your computer connected to your testing device, open a terminal and run the following command, using the package name for your application:
$ adb logcat | grep com.example.guessthenumber
This will show log statements filtered to your app specifically.
Test each purchase type by actually using your app. Monitor your logs along the way to debug any unexpected behaviors. Test edge cases too. For example:
Test all the unexpected scenarios now rather than discovering them in production.
During all of this, your app is talking to Amazon's real servers, so you're getting authentic purchase flows without affecting real customers.
To reset IAP purchases, return to the Manage Testers page in the Amazon Developer Console. Select your testers and then choose from the available reset actions.
This way, your testers can go back and test your app from a clean state.
DevTest speeds up your IAP development and debugging process by removing the cycle of submit, wait, test, discover bugs, repeat. With it, you can test your purchase logic quickly—immediately after writing it.
Use DevTest early in your development process. Write your IAP code. Set up DevTest. Test everything locally with quick and easy iterations. Then, move to Live App Testing with confidence in your IAP code. Your beta testers can focus on user experience instead of finding basic integration bugs.
The time savings alone make DevTest worth setting up, but this will also help you catch broken purchase flows before they reach production. For detailed setup steps, refer to Get Started with Appstore DevTest for IAP, then use DevTest in your next Amazon Appstore project today!