Sdkbox.IAP.refresh is successfull, but return wrong data

Hi all.
I am using IAP plugin v2.0.3.4 with cocos2d-js-v3.6.1.
I have created and configured products and test accounts in iTunes Connect. I configured my sdkbox_config.json such as follow:

{
"android": {
    "GoogleAnalytics": {
        "trackingCode": "my tracking code"
    }, 
    "Facebook": {
        "debug": true
    }, 
    "iap": {
        "items": {
            "test_product_2": {
                "id": "sly_coon_test_2d"
            }, 
            "test_product_1": {
                "id": "sly_coon_test_1d"
            }
        }, 
        "key": "here is my key"
    }
}, 
"ios": {
    "GoogleAnalytics": {
        "trackingCode": "my tracking code"
    }, 
    "Facebook": {
        "debug": true
    }, 
    "iap": {
        "items": {
            "test_product_2": {
                "id": "sly_coon_test_2d"
            }, 
            "test_product_1": {
                "id": "sly_coon_test_1d"
            }
        }
    }
}

}

Then on my real test iOS device (without account information as described here: https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/TestingInAppPurchases.html ) I do next:

    g_iap_listener = new IapListener();
    sdkbox.IAP.setListener(g_iap_listener);
    sdkbox.IAP.init();
    sdkbox.IAP.refresh();

, where IapListener is my custom iap listener object:

var IapListener = function()
{

}

IapListener.prototype.onSuccess = function(product_info)
{
    LOG("IapListener.onSuccess: product_info: " + JSON.stringify(product_info));
}

IapListener.prototype.onFailure = function(product_info, msg)
{
    LOG("IapListener.onFailure: msg: " + msg);
}

IapListener.prototype.onCancelled = function(product_info)
{
    LOG("IapListener.onCancelled: product_info: " + JSON.stringify(product_info));
}

IapListener.prototype.onRestored = function(product_info)
{
    LOG("IapListener.onRestored: product_info: " + JSON.stringify(product_info));
}

IapListener.prototype.onProductRequestSuccess = function(products)
{
    LOG("IapListener.onProductRequestSuccess: products: " + JSON.stringify(products));
}

IapListener.prototype.onProductRequestFailure = function(msg)
{
    LOG("IapListener.onProductRequestFailure: msg: " + msg);
}

IapListener.prototype.onInitialized = function(ok)
{
    LOG("IapListener.onInitialized: ok: " + ok);
}

IapListener.prototype.onRestoreComplete = function(ok, msg)
{
    LOG("IapListener.onRestoreComplete: msg: " + msg + ", ok: " + ok);
}

Then I get follow result:

JS: 19.02 15:14:29:744  IapListener.onProductRequestSuccess: products: [{"name":"test_product_1","id":"sly_coon_test_1d","title":"","description":"","price":"","currencyCode":"","receipt":"","receiptCipheredPayload":""},{"name":"test_product_2","id":"sly_coon_test_2d","title":"","description":"","price":"","currencyCode":"","receipt":"","receiptCipheredPayload":""}]

But I have description, title and price for that products in iTunes-Connect.
Moreover, when I change product id in the config to some random string I get the same result, so I guess this data is wrong.

And when I try to purchase something from my list I get the error “Invalid product please double check the product id on itunes connect”

So it seems like IAP plugin don’t perform any real requests to fetch the products real data maybe due to some errors, but I get successfull result with wrong data.

How is it possible ?

What’s the state of your products on iTunes connect, they have to be in at least “Ready to submit” statue

Thanks for the answer! My products are exactly in Ready to submit state

can you also double check if the bundle id is correct?

Thanks for the help. Bundle ID is correct. The problem was due to updated contracts from Apple. When I aggreed all changes the problem disappeared. But I have tested fetching products information using Store Kit and it returned my products ids as invalid. So why IAP didn’t inform me about it? I was unaware about invalid status of my products until Store Kit told me that.

Hello @skalexey2

I believe the IAP data is solely dependent on the success/failure response generated by the store.
that is why you were not able to get any contract unsatisfied issue log in sdkbox.

But we are glad it solved your issue. :smile:
It gave us another use case to check on further issues.

Thank you.

Best,
Pabitra

Hmm, I’ll double check if we pass the invalid status