I'm trying to use in app purchases for iOS in my Cordova application.
So far, I tried using 2 plugins: - https://github.com/AlexDisler/cordova-plugin-inapppurchase - https://github.com/j3k0/cordova-plugin-purchase
None of them work. Since the last plugin uses some kind of custom receipt validation platform, I decided to skip that one.
My code for the first plugin looks like this:
window.inAppPurchase
.getProducts([subscriptions.FLOXER_PRO_IOS_PRODUCT_ID])
.then(function(products) {
console.log(products);
window.inAppPurchase
.buy(subscriptions.FLOXER_PRO_IOS_PRODUCT_ID)
.then(function(data) {
console.log(data);
})
.catch(function(err) {
console.log(err);
});
})
.catch(function(err) {
console.log(err);
});
Safari console log output:
[Log] [] (0) (bundle.js, line 67)
[Log] {errorMessage: "Unknown product identifier", errorCode: 100} (bundle.js, line 67)
XCode logs:
2016-11-07 11:46:32.940653 Floxer[831:207602] Using UIWebView
2016-11-07 11:46:32.942682 Floxer[831:207602] [CDVTimer][handleopenurl] 0.057995ms
2016-11-07 11:46:32.943943 Floxer[831:207602] [CDVTimer][intentandnavigationfilter] 1.214981ms
2016-11-07 11:46:32.944015 Floxer[831:207602] [CDVTimer][gesturehandler] 0.042021ms
2016-11-07 11:46:32.944038 Floxer[831:207602] [CDVTimer][TotalPluginStartup] 1.437962ms
2016-11-07 11:46:33.316991 Floxer[831:207602] Resetting plugins due to page load.
2016-11-07 11:46:34.149838 Floxer[831:207602] Finished load of: file:///var/containers/Bundle/Application/0CFA94CE-294B-43C8-8BCD-28C76B8F303E/Floxer.app/www/index.html
2016-11-07 11:46:42.654647 Floxer[831:207602] RMStore: products request received response
2016-11-07 11:46:42.654829 Floxer[831:207602] RMStore: invalid product with id com.coqtail.floxer.pro_account
2016-11-07 11:46:42.676313 Floxer[831:207602] RMStore: unknown product id com.coqtail.floxer.pro_account
2016-11-07 11:47:34.804099 Floxer[831:207602] RMStore: products request received response
2016-11-07 11:47:34.804265 Floxer[831:207602] RMStore: invalid product with id com.coqtail.floxer.pro_account
2016-11-07 11:47:34.870319 Floxer[831:207602] RMStore: unknown product id com.coqtail.floxer.pro_account
I'm using a simulator for iOS (not logged in), could this be a potential problem? Do you need a real account to test In App Purchases?
I created my In App Purchase in iTunes Connect and It's not approved yet. This shouldn't be a problem right? I assume you don't need a verified In App Purchase during testing.
Did anyone experience this issue before? I'm searching Google for days now and can't seem to find a clear solution to this problem...
Help would be appreciated!
I had the similar problem. The answer I found on gitHub worked for me:
You need to have a 'Paid Applications' contract in iTunes Connect for your Paid products to appear. To do this go to your iTunes Connect homepage and select 'Agreements, Tax, and Banking'. Fill out your Contact, Bank and Tax info. Submit the form and wait 15 minutes for contract to process.
A good way to test is to add a free consumable product, this does not need a 'Paid Applications' contract.
Thanks to @stoconnor