[SOLVED] [IAP - Android] onSuccess not being triggered

Hello Guys,

I am facing issues with inapp billing using SDKBOX. Once I click on purchase its showing purchase is successful but my Listener method onSuccess did not triggered. Just want to tell that the same code is working fine in iOS. but its not working in Android. Please help me for the same.

Thanks in advance.

Can you provide your cocos2d-x version and sdkbox version?

Also can you try the sample code and see if it has the same problem on your device?
https://github.com/darkdukey/sdkbox-iap-sample

@nite, We are also helping through ZenDesk with this issue. Here are the versions:

cocos2dJs 3.6.1
adt-bundle-windows-x86_64-20140702
android-ndk-r10
apache-ant-1.9.4
jdk1.8.0_05
python 2.7.5
sdkbox 1.2.3
cocos code ide 1.2.0…

Hello Nite,

Thanks for the response.

Here are the details
Cocos2D-X : 3.6
SDKBOX IAP : v1.2.3.3

I will try the sdkbox-iap-sample and will let you know.

Finally I got it working. I really appreciate your support and interest guys.

Thanks a lot.

Can you post how did you fix this?

He did this:

 I just made a noticeable change that is I moved `super.onActivityResult();` at the very beginning of the `onActivityResult` method. It might be not the solution but doing some minor changes its working now.

Hi, i’ve the same issue on android (it works on ios)… with sdkbox 2.3.1 and cocos2dx 3.11 :frowning:

is it possible to get a sample project from you to try it out? It usually is because a missing integration step. Mostly Cocos2dxActivity was not integrated correctly. Here is the Manuel integration guide

I’ve made a manual installation but i see no difference with Cocos2dxActivity modified by sdkbox installer.Cocos2dxActivity.java.zip (4.2 KB)

The purchase of inapps in android works (the onsuccess callback is just not called by the inapp is really bought) so i suppose all my configurations (androidManifest & sdkbox_config/json) are ok.

Your Cocos2dxActivity.java looks correct, you mentioned onSuccess was called?

Nop, that’s my issue. On android onSuccess is not called right after seeing the sucessfull confirmation popup by google. But if i quit application and i retry to buy the same (consommable) item few seconds after, onsuccess is called directly without asking me anything (not even the buy popups). It’s like sdkbox take some time, a reboot of my app and a retry to call on success. I don’t know how sdkboxinapp works but i think in my setup it does not detect the confirmation my google right after it appeared.

On ios no issue.

We did couple rounds of testing, wasn’t able to reproduce this issue. can you make sure all the settings are correct?
Note for google play IAP to work correctly a lot of things has to match. For example the build number, package id, also you have to use a release build to test real purchase.

Yep, i don’t know what to test more.
As i receive the confirmation email from google for the test order i suppose this part is working.

I’ve downloaded your sample iap project but your iap are not in test mode anymore and i don’t want to pay severals euros just to ensure that i’m able to run it!

you can opt-in test by clicking this link on your device.

https://play.google.com/apps/testing/org.cocos2dx.PluginTest

Is there anyway I can take a look at your project?

Can you tell me where are the sources of this iap test project?
It seems different from https://github.com/sdkbox/sdkbox-sample-iap/tree/master/cpp

thx.

don’t worry about the app, that opt-in link just to grant your user and device permission to make test purchases with the sample (free of charge)

Yes but my goal is to compile the app to compare it’s code and mine :slight_smile:
i’ve no doubt that sdkbox is able to handle google inapps (it works @95% in my app, there is just this onsuccess issue ) and i want to analyse to found what’s wrong in my code. I’ve downloaded the IAP Test from google store and it’s not the same app as sdkbox-sample-iap (which i was able to compile and run but not test), that’s why i wanted to see the source code of the IAP test.

I can give you my code but i don’t use an automatic integration of sdkbox and i don’t even have the same project structure as the one created by cocos2d (i didn’t want each game to come with it’s own version of cocos2d so i made symbolic links etc…).

So the onSuccess only happens after the app restart for you? This means, the item is been purchased, but not been consumed. If there is a way you can send me a sample of your code, I can look into it further.

Hi, did you saw the code i sent you by private message?