Disclaimer: This guide was originally written by Andy Reitberger. It has been published here with his consent. If yo want to access the original article you can do it clicking here.

Important: Add the “Cocoon InApps” plugin to your project (you must have installed the Cocoon Construct2 plugin).

Create products

Login to your Google Play Dev. Console and select your game.

gpg_button

Then select “InApp Products”. If this is your first visit of this tap you may need to connect your Merchant Account with your Developer Console. If you don’t know how to connect your merchant account with your developer console, please visit this link.

merchant_button

If your account is connected, then click on “+ Add new Product”.

iap_new_product_id

Confirm the dialog and enter all needed information about the perk, like prices and the description. Once you are done click on Save & Activate.

Insert the IDs

In order to allow the purchase of the item you need to add its ID to your Construct 2 project. The best way to do this is to use global variables (or local). If you using our Cocoon Developer Template you will find 3 variables called:

  • Product1
  • Product2
  • Product3

Just add your ID there (Product 1 = removeads for instance).

You can download our free capx examples here.

template_button

There you will find a complete code example for the InApp Purchase Function.