Problem with consumable purchase restoration on Android

Problem with consumable purchase restoration on Android


Sdkbox iap doesn’t restore consumable purchases after restart on Android.

On iOS restoration works fine: app starts, sdkbox.IAP.init() called, onSuccess callback with cipheredReceipt is called.

Configuration for iap validation on my server:
before init sdkbox.IAP

It works well for all other cases.

I debugged that after calling sdkbox.IAP.restore(), java listener in com.sdbox.plugin.IAPWrapper (sdkbox.jar) IAPWrapper.onPayResult method is called with data i needed, but neither onSuccess nor onRestored callback is called in my listener in typescript.

So, how can i get purchase data for verification, if sdkbox.IAP.finishTransaction not called immediately after listener’s onSuccess callback?

I’m using Cocos Creator v1.9.3 and iap plugin v2.4.1.1


so, your issue is can’t get trigger onRestore after call sdkbox.IAP.restore()?

consumable product willn’t send to native.


Step by step reproduction:

  1. Purchase consumable product
  2. Got listener’s onSuccess callback with purchase info for validation.
  3. Stop/crash app on breakpoint inside onSuccess.
  4. Restart the app
  5. After sdkbox.IAP.init() I expect to get purchase info again to resume client-server validation flow.
    In iOS i would get onSuccess callback with purchase info, in Android not. Why?



Env: Cocos2d-x plugin v2.4.1.1

We have the same issue, and users reported that they can’t purchase any more. They got “7 item already owned” error message which should be fixed in v2.4.1.1 according to change log page.

P.S. only specific items for one user cannot be purchased, other items can be purchased as normal.


the item is consumable? you need consume(sdkbox::IAP::finishTransaction) it by yourself or enable auto consume(sdkbox::IAP::setAutoFinishTransaction)


Because Apple has the concept of a transaction. When you stop/crash app on breakpoint inside onSuccess, the transaction is not done. but Google IAB not.

  1. save purchase Info first in onSuccess
  2. we provide a getPurchaseHistory(only valid on android), you can get all purchase history(include cancelled, invalid). this API is not commonly used, but can be used in special cases.


It’s consumable.
And isAutoFinishTransaction() is true.


Could you provide detail recovery flow or an example project to fix this kind of issues?
How could we identify there was one transaction not finished and to let the item become buyable again?

  1. are you fill key with your value in sdkbox_config.json?
  1. can you detail steps, so we can reproduce this issue?



We filled the key, but not in sdkbox_config.json.
We created a json string after our server sent item information to feed it into sdkbox::IAP::init(configJsonStr.c_str()).