The Cocoon Amazon AppStore InApp Purchases plugin is a Cordova plugin aimed at providing easy integration with  the Amazon AppStore InApp Purchases  API.


To add the Amazon AppStore InApp Purchases plugin to your project first go to your project configuration and once there go to the Setting  section and click on the “Plugins” tab. You should see something like this:

New Cocoon

If you click on the “Cocoon” category you will see al the Cocoon available plugins.  Over the plugins list you will see a dropdown menu set to “All” by default. Click on the menu to see the available Cocoon plugins categories, you should see a list of plugins with at least the following groups:

Screen Shot 2016-01-05 at 16.40.33

Select the “In-App Purchases” category and the In-App Purchases for Amazon plugin should be filtered in the plugins list.

Screen Shot 2016-01-18 at 14.17.21


Now click on install and your project will include the In-App Purchases for Amazon plugin in the next compilation.

Screen Shot 2016-01-18 at 14.17.30



This plugins doesn’t need any parameters.


Cordova needs to be specifically loaded in your index.html so it can start the Cordova framework and load the plugins that you have installed in your project. So first thing is to add the “cordova.js” script tag to your index.html.

That’s the only code script you need to include in your index.html for the plugin to be ready to be used. Cordova will do the rest.

Important: Remember to wait for the “deviceready” event before using the plugin as that is the moment when the plugin will be fully initialized.


Let’s see some code snippets showing how to use the Cocoon Amazon InApp purchases plugin in your application.


First thing you need to do is to setup the purchases events listeners for purchase, error and complete as you can start receiving callbacks as soon as you initialize the service.

Fetch products

This methods returns all the products that you have created in the store so you can list them to the user.

Important: The Amazon AppStore InApp purchases plugin only supports managed products and it doesn’t support subscriptions.

Get cached products

If you have already called the fetchProducts method and you just want to get the already fetched ones, you can just call getProducts.

Purchase products

This method starts a purchase for a productId. You can optionally pass a callback for errors although you will also be notified by the service error callback.

Check if a product has been purchased

Purchases verification

The purchases should be verified to check that the purchase is legit. You have two ways of doing this.

Custom verification

You can get the verification call back with the productId and the receipt so you can just acknowledge it or verify it in your own server. You can read how to do it here.

Ludei verification

Another option is let the Ludei servers to verify the purchase for you. We are currently working on this verification mode for the Cocoon cloud so it doesn’t work at the moment of writing this.

Other API methods

Please see the full API below and the example for more Google InApp Purchases API methods.






Testing the Amazon AppStore InApp Purchases integration is quite a complex process and requires configurations in the Amazon Developer Console.

  • Go to the Amazon Developer Console and setup the app.
  • Read the Amazon InApp purchases manual thoroughly.
  • Create products for your application and publish them.
  • Install the Amazon AppStore InApp Purchases plugin in your Cocoon project.
  • Compile a signed Developer App. It’s important that it’s signed as it’s a requirement for being able to test it later.
  • Launch your app from the Developer App using a zip or a url.

All this process is tedious so we recommend to use the Developer App.