Hello...
I'm using IAP objects for Android only. Honestly I did not try CocoonJS but the event flow shown on Scirra site about CocoonJs tutorial appears to be almost identical. So, in short, i strongly recommend to read that tutorial carefully and try to apply the same steps, but using the IAP plugin.
Before going to C2, it is mandatory that you have a Google developer account, with the app added, and have at least an in-app purchase created inside the Google play account, and I believe the in-app product must be set to published. Here I use a 'managed' product type of digital good on Google side, which, to keep it simple, means "pay once, keep forever", because Google will keep track of your purchase. Feel free to try the other digital good type option (the so called unmanaged or consumable good).
You may also want to set up your Google merchant / Wallet with your bank account, so that the purchase flow can be for real (and you may refund the purchases almost instantly as you receive the notification).
Whan your app is ready for testing, be sure to publish your alpha or beta version to make the beta testing available for users of a google group you've previously created.
Note: if you are the app developer (i.e. you use the same gmail account of the developer), when you make a purchase request through the IAP, A google play lightbox will appear over your app, telling you that you can't buy your own products - Yes, it is quite idiot, security paranoia I suppose, but the full purchasing process may be made only via another device if that is the case. However I can tell that if this lightbox does appear, it is very likely taht the purchases are already ok, and you then have to care about minor things (like handling what happens after purchase was made, for example saving a local variable to keep track of the purchase if you like to - if you don't, you have to ask google play for owned products every time, so every time you don't have a working internet connection, you would risk to roll back to the 'free' version of your app)
I managed to get it work on test mode set to false on IAP official plugin, but I believe it should work in test mode too.
First of all, you should ensure that, as soon as possible in the start of layout, you add your products with the Add product action (mine are one-time purchase, the 'managed type', i haven't checked the unmanaged/consumable digital goods yet) and ONLY in a sub process (so that you can be sure it is done after the first step) call the Request store listing action.
Under On store listing success, you can finally check if a product is owned by the user with Has product condition. Here I believe it is mandatory to use product ID or SKU code you set in your (Google) developer board settings. I don't know if you are forced to call the products accordingly in the Add product actions on start of layout, but I think so.
The third screenshot is more about trying to handle all possible error conditions, one per event. One should consider to have one or more text objects showing whatever is happening (I made a message function "showInfo" for that, passing it some particular text everytime). The advantage of IAP object is that it's able to capture a nice amount of different problems. These error events worked like a charm for me. For example, if you are yourself the game publisher, Google for some weird reasons won't let you buy anything (!) and show a popup box over your app telling that you can't buy. When you close it, IAP raises a product purchase failed fatal error...
Note: checking the Is store available with IAP requires that you add the Trigger Once while true condition, otherwise it seems to trigger at every tick/fps!
You can then associate a button click to the purchase action and see what happens. You might want to store in a webstorage variable the purchase success, so that, even without internet connection, the purchase is 'saved' and persistent. I did it when IAP finds that a product is purchased, but this is just a way (it is because I call it inside the request store listing for a second time after a user buys something).
Roughly, these are the blocks around which the IAP's are set.
Please ignore the other platform checking and other actions, it was the true code inside my app, and it must be updated.