API Overview
In-App Purchasing for web apps comprises three major elements:- Amazon Services Library - A JavaScript class that manages the interaction between your web app and the Amazon native IAP APIs.
- Purchase Handlers - You provide methods in your web app to respond to callbacks from the Amazon Services library.
- Receipt Verification Service - An Amazon service that you can use to validate the customer’s purchase receipt.
- Register the Purchase Handlers with the Amazon Services library.
- Call the IAP API methods at appropriate points in your app.
- Respond to the callback methods.
API Flow
The following list itemizes the flow for a web application using the Amazon Services library. The list item numbers correspond to the callouts in the figure after the list:- Implement a Purchase Handler method.
- Register your Purchase Handler with the Amazon Services library.
- The app initiates the in-app purchase.
- Response notification is handled by your Purchase Handler method. The above steps represent the minimum required steps. We recommend the following additional steps for a real-world implementation:
- Your app persists the receipt.
- Your app sends the receipt to you app server.
- Your app server sends the receipt to the Amazon RVS for validation, and receives a response.
- Your app server sends the response to your app.
- Your app persists the result.
The Amazon Services Library
The Amazon Services library is an integral part of the In-App Purchasing API. After you initiate a purchase using the In-App Purchasing API, the library presents an Amazon-branded user interface to complete the transaction. To include the JS Library in your app, add the following<script> tag in the main HTML file of your web app:

