How to add inapp billing (inapp purchase) in Cocos2d-X project?

How to add inapp billing (inapp purchase) in Cocos2d-X project?
0.0 0


Hi !

I am currently developping an app which will be on Android Market and Appstore (iOS). How can I implement in my Cocos2x-project :

  1. the Google code for inapp billing on Android Market ?
  2. the Apple code for inapp billing (or inapp purchase to use the Apple terminology ?

I am currently developping on Xcode but I think that the answer is not really linked to this fact…

A very detailed step by step tutorial for Google and Apple cases would be appreciated )

Thanks :slight_smile:


I think you need to made calls to JNI. (on android) and calls to objective-c code on xcode.

Look at the source code of CocosDenshion on cocos2d-x, and look how it does.

Maybe you can use this library for android version (and made two simple calls)

Are you Steffen I.?


There is an open source project that handles in app billing for Android and they are planning to launch iOS as well. Check out - you can either look at the source code as reference on Github or you can use it as a library/SDK which is probably safer.


good ….



I’m working on cocos2d-x 3.0 and i have problems with iOS in-app purchase.

I followed the steps of a lot tutorial and nothing helped, like this:

I did everything but the blog is wrong in a lot of point like: said put this to header and show the .mm and vicaversa and didn’t show the complete code of the last function, and also didn’t put the sharedobject in the base *.m class and such…

i looked after Ray version which seems pretty cool but it’s only for cocos2d and not cocos2dx and also contains a few deprecated functions too… so I’m totally lost now…

Can anybody please provide a complete tutorial which is compatibile with iOS 8.1 and cocos2d-x 3.0 ? Or give a code sample or something. I have no idea how to solve this!

Thank you for your help!


I also try out soomla.

i followed the steps here:

but when i try to init the soomla like this:

in ApplicationController

 id<IStoreAssets> storeAssets = [[MuffinRushAssets alloc] init];
 [Soomla initializeWithSecret:@"ChangeMe!!"];
 [[SoomlaStore getInstance] initializeWithStoreAssets:storeAssets];

it didn’t find the header. i do the setup of search headers paths to:


any advice?