In-App Purchase on Google Play (Android) using CocoonJS

Favourite 53 favourites
Tutorial written by cvpOriginally published on 13th, September 2013 - 1 revision

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
Open full size image

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!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

5
Blacksmith 8,782 rep

@cvp, thanks for posting this! I'm sure lots of people will find it very useful :)

Friday, September 13, 2013 at 7:45:37 AM
2
Lordshiva1948 44.3k rep

cvp thanks this has help me

Friday, September 13, 2013 at 8:12:21 AM
2
yousicc 6,474 rep

BIG thanks for this one. I can finally make some real money

Saturday, September 14, 2013 at 1:05:17 AM
2
fishbottle 2,824 rep

Very valuable, thanks for sharing! I look forward to any followup info.

Sunday, September 15, 2013 at 2:21:57 AM
1
sosensible 10.3k rep

sweet always favorite inn app purchase tuts

Wednesday, September 18, 2013 at 6:07:33 PM
1
AbelaNET 14.9k rep

Thanks for sharing

Sunday, September 29, 2013 at 6:17:41 PM
1
BAnyBudde 3,225 rep

excellent tutorial, one question though, will this work in the sandbox environment if you replaced premium with other wording?

Thursday, October 03, 2013 at 7:53:07 PM
1
cvp 4,451 rep
excellent tutorial, one question though, will this work in the sandbox environment if you replaced premium with other wording?
quoted from BAnyBudde

The word "premium" is just the name of my product in Google Play. It has nothing to do with the sandbox mode.

Wednesday, October 09, 2013 at 9:07:31 PM
2
construct2user 1,341 rep

I Think We Have To Do Page In Order:- 2 > 3 > 1

Thursday, October 17, 2013 at 11:14:11 AM
1
BAnyBudde 3,225 rep

I just wanted to query this, does it still work with R146 ? I had my IAP working on R139 with my own method very similar to yours. It suddenly stopped working and kept prompting me for verification Required, and the purchases would just fail... I have had no success since then in getting IAP to work. I am set up with Apple, but everything outside Construct has been set up correctly. Can anyone help us, we released our game and its getting thousands of downloads, and not a cent to show for all of our hard work. If anyone can help plz do so ASAP

Kind regards

Thursday, October 17, 2013 at 9:03:44 PM
1
BAnyBudde 3,225 rep

@cvp
forgot to add that in the comment above

Thursday, October 17, 2013 at 9:04:32 PM
1
cvp 4,451 rep

@BAnyBudde
Sry i havent yet tried it on IOS so cant really help you there.

Tuesday, October 22, 2013 at 1:19:32 PM
1
cvp 4,451 rep
I Think We Have To Do Page In Order:- 2 > 3 > 1
quoted from construct2user

You can do it in the order you want. But the one will not work without the other :-)

Thursday, October 24, 2013 at 7:11:16 AM
1
WizLore 2,278 rep

I had sandboxmode turned on, but was able to do the purchase anyway... how does it work?

Thursday, October 24, 2013 at 5:48:05 PM
1
cvp 4,451 rep

@Wizlore As far as I know the sandboxmode checkbox should make the difference between money beeing withdrawn from your account or not. You should still be able to make the purchase for testing with the sandbox turned on.

Sunday, October 27, 2013 at 8:59:10 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.