Implementing In app billing for android

Hi there, I’m new in cocos2d-x. I want to add In app billing for android but still get stuck. I have a c++ file called: InAppPurchase.cpp which had already implemented for iOS:

#include "InAppPurchase.h"


using namespace cocos2d;
TitleScreenLayer* titleScreenSceneObjectInAppPurchase=0;

void InAppPurchase::requestProducts(TitleScreenLayer* titleScreenDelegate)
{
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#endif
    
#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    titleScreenSceneObjectInAppPurchase = titleScreenDelegate;
    InAppPurchaseIosBridge::sharedInstance().requestProducts();
#endif
}
...
void InAppPurchase::productsReceived()
{
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	
#endif
    
#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
//    CCLog("InAppPurchase productsReceived");
    if (titleScreenSceneObjectInAppPurchase!=0) {
        
        titleScreenSceneObjectInAppPurchase->productsReceived();
        
    }else{
        CCLog("titleScreenSceneObject is not available for productsReceived");
    }
#endif
}

My question is: how do I implement the requestProducts and productReceive like iOS did? I cannot find any tutorial step by step for this. I have read this tutorial, but I thought it is quite different from my case.

We have SDKBOX: http://cocos2d-x.org/sdkbox

1 Like

I didn’t see its detail document, so how do I do after downloaded(my environment is windows 7)

There is documentation here: http://docs.sdkbox.com/en/

1 Like