What is the preferred way of implementing In App Purchase ?

What is the preferred way of implementing In App Purchase ?
0.0 0


I found either I can use some Open Source SDK like Soom.la or write my own c++ wrapper to call storeKit SDK and I think this is what Soom.la is doing underneath. Please share your experiences with approach you adopted and suggestions.


I used a native bridge to implement a unique In App purchase store for each market.

Soom.la is an OK place to look for design, but it is very limited and doesn’t support Amazon at all.

Also, you have to “think Soom.la” instead of the native store’s terminology which makes the market-side setup too hard.


can you give some general idea how to go about implementing native bridge ? may be pseudo code ? It will be very helpful for me. :slight_smile:


If you are developing for android then for the java part you can take reference from IabHelper project provided in android Samples and you just need to implement some methods which you can call from your C++ code. I would suggest not to use Soom.la API because it uses older API for billing and there were some glitches that caused false purchases. However you can take reference of soomla project for writing JNI bridge functions.


thanks Vikas for your valuable suggestions , right now I am targeting iOS platform , so while porting to Android I will definitely look into that part


I use a shared wrapper called “nativeinterface”


#include "NativeInterface.h"
#include "platform/android/jni/JniHelper.h"
#include "platform/CCCommon.h"
#include "IOSHelper.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) // for win32 only
#include "HOSGameStore.h"

#if defined(AMAZON)
#define JNIHELPER "com/tresebrothers/games/heroesofsteel/JniHelper"
#define JNIHELPER "com/tresebrothers/games/heroesofsteel/JniHelper"

using namespace std;

CCString * NativeInterface::nativeCallbackOpen(const char* str){

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) // won't compile this part if IOS

    JniMethodInfo minfo;

    if(JniHelper::getStaticMethodInfo(minfo, JNIHELPER,  "open", "(Ljava/lang/String;)Ljava/lang/String;"))

        string tmp(str);

        jstring message = minfo.env->NewStringUTF(tmp.c_str());
        jstring return_value = (jstring) minfo.env->CallStaticObjectMethod(minfo.classID, minfo.methodID, message);

        string ret = JniHelper::jstring2string(return_value);

        CCString *sret = CCString::create(ret);


        return sret;

#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) // won't compile this part if ANDROID

    IOSHelper *hios = new IOSHelper();

    string tmp(str);
    string ret = hios->nativeCallbackOpen(tmp);

    CCString *sret = CCString::create(ret.c_str());
    delete hios;
    return sret;

#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) // for win32 only

    CCString *pret = CCString::create("none");
    ShellExecuteA(NULL, "open", str, NULL, NULL, SW_SHOWNORMAL);
    return pret;


    CCString *pret = CCString::create("none");
    return pret;



JniHelper wraps JNI methods.

IOSHelper is an objective-C++ class (.mm)

Win32helper is just what you’d think, not sure what store to use anyway.


Of you could try to use that EasyNDK thing :wink:

That is, if you don’t mind a ton of CPU work for JSON encoding :wink:


Hi There,

Happy to let you know that SOOMLA now supports Amazon :slight_smile: