I have struggled ALOT with this myself, and now I finally got it working, so i though I would share a bit :-)
Disclaimer!
I have not been able to get restore purchases to work, I will update the tutorial when i hopefully get it to work.
This is not a detailed explanation of each and every feature related to the IAP, but it will give you an introduction to the IAP with CocoonJS system, and hopefully enable you to make IAP work in your own app.
So in short... this is no fancy solution... at all. But I got it working and wanted to share :-)
Prerequisites
You need to sign up for a Google play developer account (here)
You need to sign up for a Ludei(CocoonJS) premium account (here)
Getting your product ready in Google Play
To get your app onto Google Play, follow this great tutorial.
once you have created your product and uploaded the APK to Google Play, we are ready to proceed.
You can see the product I have made here (called testIAP)
You will then see the Store Listing
Go to In-app Products
Click the Add new product button
There are 3 types of products:
Managed: User can only buy once. Google keeps track of purchase
Unmanaged: User can purchase many time (something like ingame gold) Google does not keep track
Subscription: A monthly subscription for your app
Select Managed
Enter a name for your product, in this case i have named it premium3
Press Continue
You will now have to enter information about the product (title, description and price)
After that is done, press the Auto-convert prices now button.
At the top set the product to Activate
Our In-app product is now ready in Google Play!