I am using soomla framework with cocos2dx android I tried with the android.test.purchase and it worked fine. But when i check with the real purchase item it doesnt work at all. And it purchased only one time but it is unmanaged item.
Heres some of the code : Purchase Asset:
CCVirtualGood *shieldAdded = CCSingleUseVG::create(
__String::create("3 Shields"),
__String::create("Increase 3 Shields"),
__String::create("shields_increase"),
CCPurchaseWithMarket::createWithMarketItem(CCMarketItem::create(
__String::create(SHIELDS_PURCHASEID),
CCDouble::create(0.99))
)
);
Event Handler :
This is the function that calling back i think when it succeeded :
if(purchasable->getItemId()->compare("shields_increase")==0)
{
int shieldNumber=UserDefault::getInstance()->getIntegerForKey(shieldSaverNumber, 0);
shieldNumber+=3;
UserDefault::getInstance()->setIntegerForKey(shieldSaverNumber, shieldNumber);
}
Store Scene :
This the calling methods for purchase :
soomla::CCSoomlaStore::getInstance()->startIabServiceInBg();
soomla::CCError *err;
soomla::CCStoreInventory::sharedStoreInventory()->buyItem("shields_increase", &err);
if (err != NULL) {
log("error %s",err->getInfo());
}