[Solved] IAP “onRestored” was not called on iOS(Javascript)

[Solved] IAP “onRestored” was not called on iOS(Javascript)
0

#1

“premium” is a non-consumable item on iTunes connect.

After I called “sdkbox.IAP.purchase("premium”)”,
“onSuccess : function (product)” was called.

It’s OK, and I parchased the “premium.”

After I called “sdkbox.IAP.purchase("premium”);”
I called “sdkbox.IAP.restore();”,
and then “onRestoreComplete : function (isResult, msg)” was called,
but “onRestored” was not called.

(isResult was true, and msg was “”, when “onRestoreComplete” was called.)

Currently I can’t restore an item.

How do I restore an item?


(And also,
void onRestored(const sdkbox::Product& info)
is not called
on class IAPWrapperJS”
in PluginIAPJSHelper.h
with using a break point of the debugger.)


I useed a sandbox tester account, and an iPhone device(not simulator.)

cocos2d-x(Javascript) 3.14
SDK BOX V1.0.1.17


————

sdkbox.IAP.setListener({     onSuccess : function (product) { 
        cc.log("onSuccess");
        if (product.name == "premium") {
            cc.log("purchased");
             ...			
        }
    }, onFailure : function (product, msg) {
        cc.log("onFailure");
            ...
    }, onCanceled : function (product) {
        cc.log("onCanceled");
            ...
    }, onRestored : function (product) {
        cc.log("onRestored");
            ...
   } , onProductRequestSuccess : function (products) {
        cc.log("onProductRequestSuccess");
            ...
    }, onProductRequestFailure : function (msg) {
        cc.log("onProductRequestFailure  error:" + msg);
            ...
    },onRestoreComplete : function (isResult, msg) {
        cc.log("onRestoreComplete isResult:" + isResult + " msg:" + msg); 
        ... 
    } 
});

———
res/sdkbox_config.json

{ 
    "android": {
         "iap": {
             "items": {
                 "premium": { 
                    "id": "premium"
                 } 
            },
              "key": “…” 
        }
     },
      "ios": {
         "iap": {
             "items": {
                 "premium": { 
                    "id": "premium"
                 }
             }
         }
     }
 }

#2

SDKBOX assume the item is a consumable by default, so you have to mark it as non-consumable


#3

Oh, it works.
“onRestored” was called.

Thank you so much.


#4

Hi, I had the same problem and solved with the same way.

The document said,

If you have IAP items, whose type is non-consumable or subscription, it is also necessary to supply the type for each item in your sdkbox_config.json. Only Android requires this step.

http://docs.sdkbox.com/en/plugins/iap/v3-cpp/#restore-purchase

so it looks like the document is not maintained.
Could you please update the document that not only android but also ios needs to set type properties ?


#5

the doc has been updated, thanks.