Hi all, I am wondering if I can debug SDKBOX IAP plugin before publish to the Google Play?
I added an product in the Google Play Console, added it to the sdkbox_config.json, but when I try check my products it returns empty array:
Also, I noticed callback for onInitialized listener doesn’t call, is it normal?
After sdkbox.IAP.refresh(); also, no one listener is called
my full code of setup is here:
export class PurchaseMain extends Component {
protected onLoad() {
if (typeof sdkbox !== 'undefined') {
sdkbox.IAP.setListener({
onInitialized: function (success) {
console.log('Initialized');
console.log(success);
},
onSuccess: function (product) {
console.log('Purchase success');
},
onFailure: function (product, msg) {
console.log('Purchase failed');
console.log(product);
console.log(msg);
//Purchase failed
//msg is the error message
},
onCanceled: function (product) {
console.log('Purchase canceled');
//Purchase was canceled by user
},
onRestored: function (product) {
console.log('Purchase restored');
//Purchase restored
},
onProductRequestSuccess: function (products) {
console.log('Purchase refresh success');
//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++) {
console.log(products[i]);
}
},
onProductRequestFailure: function (msg) {
console.log('Purchase refresh failed');
console.log(msg);
//When product refresh request fails.
},
});
sdkbox.IAP.init(sdkboxConfig);
sdkbox.IAP.setDebug(true);
console.log(sdkbox.IAP.getProducts());
sdkbox.IAP.refresh();
}
}
purchase() {
sdkbox.IAP.purchase('test_gems');
}
}
Hi, I have already submitted, thanks. I need to test from build I download from google play, or it should work from apk I install on phone after Cocos build?
As long as the version code and build number are the same, it should work.
So, you can modify the app locally and install to your phone from your computer for testing. But, must keep the version code and build number to be the same as the one available on PlayStore (no need to be a production release, an internal testing release should be fine too)
Hi, Thanks for reply, no as you see my code provided above I initialized sdkbox.
Also in documentation says I need to set up listeners first:
by the way, when I build the project with default sdkbox config from exmaple I see it works and returns products, so looks like some problem with my game. But I don’t know why, I set up products in GP, added key and product id to the config. My app ready for internal and closed testing.
As I understood, I need to upload an .apk with keystore I generated in Android Studio to Google Play Console and make internal test from this .apk version?
Hi again, we added keystore as you said, but result is the same…
But still, I can see and buy products only when debug mode is enabled in build options… I don’t understand
Here is a screenshot with debug mode enabled:
Look between “PRODUCTS START - PRODUCTS END ” logs.
We have created new app in Google Play Console and uploaded there our build with release keystore created in Android Studio. We aren’t using debug keystore from Cocos