IAP 2.3.17.X making multiple conflicting purchase result callbacks to IAPListener

IAP 2.3.17.X making multiple conflicting purchase result callbacks to IAPListener
0.0 0

#1

After upgrading to SDKBox IAP 2.3.17 I am experiencing multiple callbacks to an sdkbox::IAPListener for a single IAP purchase on Android, namely both ::onSuccess and ::onFailure

I have tested both 2.3.17.1 and 2.3.17.6 and the result is the same, when calling

sdkbox::IAP::purchase

I receive the following log entry, followed by a quick call to onFailure and a later call to onSuccess:

Error while consuming: IabResult: Error consuming sku [redacted] (response: 6:Error)

During my investigation I had a more complete log that showed the IAP worker attempting to consume the IAP result multiple times (failing on the first, succeeding on the second), however inbetween upgrades and various settings changes I have lost this log and the output seems to have been reduced from the component.

Due to the onFailure callback always coming first, this isn’t feasible to use and is causing crashes due to logic in a production application. (The app cannot always wait and presume that Success will come)

Is there a change that could have caused this in the new version of the SDK and if so, can this be patched or is there any feasible way I can access an old version to downgrade and resolve the issue ASAP?


#2

I’m testing on this.

u can get old version with http://download.sdkbox.com/installer/v1/sdkbox-iap_v2.3.17.6.tar.gz, replace with the version you want.


#3

only onSuccess callback has been invoked.

I checked with our sample https://github.com/sdkbox/sdkbox-sample-iap/tree/master/cpp

and version 2.3.17.1 and 2.3.17.6.

May I test your apk?


#4

Sure, I’ll send info in a PM.
Will post any updates here for anyone else


#5

This was resolved,

Turns out either I was mistaken (or the docs changed at http://docs.sdkbox.com/en/plugins/iap/v3-cpp/), but I had a whole set of Activity overrides (onStart, on Stop, onActivityResult etc) overridden in my AppActivity.java to call the SDKBox methods (SDKBox.onStart() etc)

However, this is incorrect, as they are already added to Cocos2dxActivity.java by the installer, hence this resulted in SDKBox.onActivityResult() being called twice: in AppActivity and in Cocos2dxActivity, hence resulting in the double processing of purchase results.
This double implementation may have been due to me at first manually implementing the overrides, followed by later using the automatic installation.

I guess the only change that occurred in the SDK (due to this double call happening for a long time with no side effects) is that duplicate calls to onActivityResult for the same purchase now results in both success and an error instead of being ignored in previous versions. Whether this is an issue or not is no longer down to me.

Thanks for the help @yinjimmy!