Problem with consumable purchase restoration on Android

can you refun/revoke, and try again, and share us the logcat.

i tested, but i always can purchase.

I tried to buy another 2 items, and while it was buying (processing), I terminated the app.
After reopening the app, the items cannot be purchased anymore.
(So in my devices, there are 3 items with issue now)

you terminated app when purchaseing, so didn’t consume.

in app client side, can’t check purchase status. you should use check purcahse status in your backend server.

http://emanual.github.io/Android-docs/google/play/billing/gp-purchase-status-api.html

if you check iitem is not consumed, and then invoke finishTransaction to consume

12-25 18:02:30.337 11743 11795 F zygote  : runtime.cc:523]   native: #16 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:02:30.337 11743 11795 F zygote  : runtime.cc:523]   native: #17 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)
12-25 18:02:30.338 11743 11795 F zygote  : runtime.cc:531]   native: #12 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:02:30.338 11743 11795 F zygote  : runtime.cc:531]   native: #13 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)
12-25 18:02:31.242 11951 11951 F DEBUG   :     #12 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:02:31.242 11951 11951 F DEBUG   :     #13 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)
12-25 18:03:18.351 12075 12121 I IAP     : AndroidManifest has no store metadata. Defaulting to 'googleplay
12-25 18:03:18.351 12075 12121 E IAP     : Can't create IAP java object of type: ''.
12-25 18:03:18.434 12075 12121 F zygote  : java_vm_ext.cc:534]   native: #12 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:03:18.434 12075 12121 F zygote  : java_vm_ext.cc:534]   native: #13 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)
12-25 18:03:18.994 12075 12121 F zygote  : runtime.cc:523]   native: #18 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:03:18.994 12075 12121 F zygote  : runtime.cc:523]   native: #19 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)
12-25 18:03:19.901 12205 12205 F DEBUG   :     #12 pc 00f162fd  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAPWrapperEnabled::setDebug(bool)+36)
12-25 18:03:19.901 12205 12205 F DEBUG   :     #13 pc 00f18dad  /data/app/com.ptfarm.pokerrrr-QqnD5g3aQW7hbYUksyahpg==/lib/arm/libcocos2dcpp.so (sdkbox::IAP::setDebug(bool)+14)

The new one crashed right away after I launched the app.
I found the size of the latest JAR is quite smaller than before.
Could you check the jar file?

Thanks,
Jo

But how should I know the item has purchased, but not consumed?
The onSuccess won’t be called.

On iOS, the same issue might happen, but I can get onSuccess right after the app reopened, so I can continue to send the payload to server.

On Android, what’s the process I can recovery this status?

My fault! Sorry. the jar file is not correct.

in you case, you should query gooogle if item consumed.

https://developers.google.com/android-publisher/api-ref/#Purchases.products

Can SDKBox provide if item consumed?
Then the app can consume again on client side?
I’m not sure when should I use the API you provide.

Or could you auto consume if the error is “7 item already owned” ?

SDKBox is using google’e BillingClient library.

the library didn’t provide api to check consoume status. and they provide a url to query purchase status or consume status.

the finishTransactin, you can invoke this after you know one item didn’t consume.
or, purchase failed with error 7 item owned

how about we provide a API tryConsumeAllProducts, which will try consume all lastest purchase. developer can invoke this as they need.

this is a solution, but, the user will got one purchase failed before they can purchase.

or add a param consume: sdkbox.api.purchase(name, bool consume=false);

Sounds a doable solution. Will I get onSuccess after finishTransaction() ?

we will do more reserach on this issue, will update at here ASAP

Thanks,

Another question:

    /**
     * to invoke ios finishTransaction api
     */
    static void finishTransaction(const std::string productid);

According to the comment, this API is only for iOS, not Android.
Should I try this on Android?

if you got 7 item own error when purchaseing. you can try this on consumeable item.

Hi

I tried. The item can be consumed. But I cannot get any callback, and the information of the item (payload) will be just lost. We need a callback to continue the process and inform the user what happened.
Could you help us with this?

BTW, the item could be bought as usual though.

we add a onConsumed callback. but it still in staging. you can try with sdkbox import iap --staging, if you have time.

Hi

When will it be released?
Sorry I don’t use command line to install sdkbox.

Thanks,
Jo

yes. will included in next release.