Test In-Skill Purchasing Skills
Before you submit a skill that contains in-skill products, your skill should meet all of the certification guidelines for skills. In addition, you should test the in-skill products thoroughly and make sure that they meet the certification requirements provided in this topic.
- Test your skill
- Test products
- Test products for different regions using the locale
- Reset test purchases
- Test consumable purchases when enabling and disabling the skill
- Optionally beta test your skill with in-skill products
- Test your live skill
Test your skill
Make sure to thoroughly test your skill following the guidelines for custom skills. See Test and Debug a Custom SKill for more information.
You need to test your skill and the purchase experience thoroughly. You can test your skill that contains in-skill purchases using any of the methods described in Ways to Test Your Skill section. You should use your developer account to test purchasing, declining, and asking for refunds or cancellations of your products when your skill is in the development stage. Also test purchasing and using up consumable products. Note that the developer account associated with the skill is never charged for in-skill products.
Test products for different regions using the locale
If your skill supports in-skill purchasing in multiple regions, you can use the Alexa Simulator to test in-skill purchasing in each of the supported regions by the default locale for that region. By using the Alexa Simulator, you do not need to create an account for a user for each of these regions, which you would need to do to test on a physical Echo device.
To test in-skill purchasing for different regions using the Alexa Simulator, do the following:
- Sign in to the Alexa Skills Kit developer console.
- Find your skill in the list. Under Actions for your skill, select Edit.
- At the top of the page, select Test.
- In the upper left, for Skill testing is enabled in, select Development.
Under Alexa Simulator, in the locale dropdown, select the locale for which you want to test in-skill purchasing.
- Use voice or text to launch the skill and interact with it as you normally would. Based on the locale that you selected, the Alexa Simulator will use the in-skill purchasing flow using the price that corresponds to the default locale for that region (marketplace). The default locale is en-US for
amazon.com, en-GB for
amazon.co.uk, de-DE for
amazon.de, and ja-JP for
Reset test purchases
When you test your in-skill products with your development account, you can reset the status of an in-skill purchase. This resets the product as follows:
To reset purchases for a product with the developer console:
- Edit a custom skill in the developer console.
- Go to the Build page and select a locale that supports in-skill purchasing .
- Under Skill builder checklist, click In-Skill Products (ISP).
- Find the product in the Linked to this Skill list and click the Reset test purchases link.
To reset purchases for a product with the ASK CLI, use the
Test consumable purchases when enabling and disabling the skill
For consumable purchases, test that the user's inventory is retained when the user disables and re-enables the skill. When doing this test, make some consumable purchases and use the items so that the
activeEntitlementCount (the total number of purchases) does not exactly correspond to the number of items the user still has.
See Maintain the user inventory if the user disables and re-enables the skill for details about how the
userId is retained for users who have made consumable purchases.
If you use the
AlexaSkillEvent.SkillDisabled event to perform cleanup when a user disables your skill, be sure test these conditions:
- When a user with consumable purchases disables the skill, your cleanup logic retains the user's inventory.
- When a user without consumable purchases disables the skill, your cleanup logic can safely clear data associated with the user. In this case, the user is assigned a new
userIdif they re-enable the skill.
Optionally beta test your skill with in-skill products
You can use the beta-testing tool to further test your skill that contains in-skill purchases before submitting it for certification. When you offer your skill for beta testing:
- A beta tester will not be charged for in-skill purchases during the beta test
- You cannot reset the products for a beta-tester while the skill is being beta-tested
- When the beta tests ends, the purchased products are automatically reset. When the skill is live, the user will be charged for in-skill purchases
Beta test for consumable products
If you plan to do a beta test on a skill that offers consumable products, you need to maintain the beta user's beta inventory separately. When your skill is published live, Alexa resets the user's purchases and returns 0 for
activeEntitlementCount. Any items that the user purchased during the beta should not be available in the live skill.
For example, suppose your beta user purchased your "five hint pack" three times during beta. Your inventory for this user therefore contains 15. When the skill goes live, the inventory you saved (15) is now out of sync with the actual live purchases (0).
To keep the beta and live inventories separate, check the
purchaseMode property for the product. For a beta user, this returns
TEST. For a live skill, this returns
Test your live skill
As mentioned previously the developer account associated with a skill never incurs the cost of the in-skill purchases. Therefore, to fully test the end-user experience, you should complete a final test pass with an account other than your developer account. This account will be charged for the in-skill purchases.