SDKBOX IAP fail to make purchase on Android

Hi,

I’m using SDKBOX IAP with Cocos2d-JS v3.8.1 on Android with this version
_______ ______ _ _ ______ _____ _ _
|______ | \ |____/ |] | | _/
| |/ | _ |
] |____| _/ _
Copyright © 2015 Chukong Technologies Inc. v0.5.8.15
installed packages:
v1.5.3.3 googleplayservices
v1.5.3.3 iap

I followed this tutorial and added code below in a scene.
http://docs.sdkbox.com/en/plugins/iap/v3-js/#make-a-purchase

sdkbox.IAP.init();
sdkbox.IAP.setListener({
    onSuccess : function (product) {
        //Purchase success
    },
    onFailure : function (product, msg) {
        //Purchase failed
        //msg is the error message
    },
    onCanceled : function (product) {
        //Purchase was canceled by user
    },
    onRestored : function (product) {
        //Purchase restored
    },
    onProductRequestSuccess : function (products) {
        //Returns you the data for all the iap products
        //You can get each item using following method
        for (var i = 0; i < products.length; i++) {
            // loop
        }
    },
    onProductRequestFailure : function (msg) {
        //When product refresh request fails.
    }
});

I make purchase with this

sdkbox.IAP.purchase(name);

The IAP can retrieve info from Google Play before purchase successful and working properly when i tested yesterday.

However, after the purchase complete, if i make the purchase again, the process will straight failed and called
onFailure

If i call sdkbox.IAP.restore(); to restore purchase, it will straight call onRestored

The big problem is when i try on other device with different Google account, it happen the same.
I can’t make the purchase and didn’t complete purchase before but i can restore the purchase successfully.

@nite @slackmoehrle
Do you have any idea on this issue?
Please help me to solve this problem.

Thank you.

I am not current on SDKBOX IAP. @nite or @pabitrapadhy will be able to assist you.

@slackmoehrle

Thanks for your reply and tag.

What’s the error message you’re getting with onFailure?

@nite

The error message is
“Unable to buy item (response:7:Item Already Owned)”

Between, it is a “Managed product”.

It seem like SDKBOX IAP is storing same Google account even on different device with different account.

Any idea why this error will happen?

Is this product you’re testing marked as non-consumable by any chance?

@nite

Do you mean in the SDKBOX config file?

Yes, it is.

"type": "non_consumable",  

What should i set to? It is a permanent purchase as to remove advertisements.

@nite

I have removed "type": "non_consumable" in the config and success to make purchase again.
However, i can’t restore the purchase as i think it has been consumed which mean i didn’t own the item.

Is it if removed "type": "non_consumable", the item will become consumable item and will be auto consume after purchased?

But i need it to be a non consumable item, how can i do that with current SDKBOX IAP?

Thank you.

If it’s a permanent purchase, you should set it to

"type": "non_consumable"

And it’s correct behavior that you can’t purchase it again

@nite

I can’t purchase the item even on different device with different Google account which never purchase the item before.

What’s the error message on the second device? “Item already owned”?

@nite

Yes, “Item already owned” if put "type": "non_consumable"

Shouldn’t be, I will try to reproduce this tomorrow and let you know. Mean while can you remove and install the app again and see if you can purchase the item?

@nite

I found a mistake.
My another device has 2 accounts which one of them is the same test account.

I will report if there is more issue.

Thank you.