I'm developing a Cordova app that contains in-app purchase. I've already got working the Android side, so the plugin flow is working.
Now I'm testing the iOS side and I can't get products correctly: they are invalid and not complete, it seems the app is not able to download product data.
- I've defined IAP (consumable) items in iTunes, associated dummy image and they show "Ready to submit" status (yellow bullet)
- IAP products are also associated in the new app version page, not submitted for review yet.
- I see this message on an iTunes page: "Your first In-App Purchase must be submitted with a new app version. Select it from the app’s In-App Purchases section and click Submit."
- I'm testing on real device with app compiled and installed directly from XCode and through TestFlight
I checked around for this problem but I did not found a clear solution, my question is: why I can't correctly download my configured products form iTunes?
- do I have to submit the whole app to get IAP approval before start testing, or
- it should be possible to test (and get products) locally the IAP stuff without any app submission/approval by Apple (And in this it could be a software problem)?
I can't see what to do. Thanks in advance for any help.
UPDATE
Here is the basic code i'm using, with this plugin, to get IAP product configured on iTunes:
function storeInitialize() {
store.register({
id: "creds_500",
type: store.CONSUMABLE
});
store.ready(function() {
console.log("\\o/ STORE READY \\o/");
console.log(JSON.stringify(store.get("creds_500")));
});
// When any product gets updated, refresh the HTML.
store.when("product").updated(function(p) {
console.info("Updating " + p.id);
console.log(JSON.stringify(p));
});
// Signal order errors
store.when("product").error(function() {
utils.userInfo("Il tuo ordine non è stato processato.");
});
// Load product data from the servers and restore whatever already have been purchased by the user.
store.refresh();
}
And here is it's output from safari console using a iPhone 4s device, installing the app from XCode:
[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Log] \o/ STORE READY \o/
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
So, almost all IAP fields are null including price, title and description (defined in iTunes side) and products are "invalid" "not-purchasable". I found in other posts that on Apple side no approval is required for testing purpose.
Where am I doing wrong?
May I ask why are you using that particular plugin and not a different one? It hasn't been updated in 8 months, which in terms of Cordova apps, means a lifetime.
Your plugin has only 200 stars, while this cordova-plugin-purchase has almost 800, and it was updated 2 months ago. Also, it includes Windows Universal compatibility, I strongly suggest you to switch plugins and retry.