cordova-plugin-purchase
cordova-plugin-purchase copied to clipboard
[IOS] store.ready() event not firing - store.order() not working - IOS 15
System info
Cordova 10.0.0
Device: iPhone 12 Pro Max iOS 15
Plugin Version: ^10.6.1
Expected behavior
I'm expecting that after registering the products, events and calling store.refresh()
I would get the store.ready()
event fired and that calling store.order('product')
would bring up the purchase window.
Observed behavior
The store.ready()
event is never fired after store.refresh()
is called. Calling store.order('product')
produces no output.
Steps to reproduce
store.verbosity = 'DEBUG';
store.validator = 'https://validator.fovea.cc...';
/*OR*/ store.validator = function (product, callback) {callback(true);};
store.register({
id: 'product',
type: store.PAID_SUBSCRIPTION
});
store.when('product').owned(function(product){
console.log('IAP owned',product);
});
store.when('product').cancelled(function(product){
console.log('IAP cancelled',product);
});
store.when('product').verified(function(product) {
console.log('IAP verified',product);
product.finish();
});
store.when('product').approved(function(product){
console.log('IAP approved',product);
product.verify();
});
store.ready(function() {
console.log('IAP store ready');
});
store.error(function(error) {
console.error(error);
});
store.refresh();
Logs
DEBUG: state: product -> registered
DEBUG: ios -> product product registered and owned
DEBUG: store.trigger -> triggering action refreshed
DEBUG: ios -> initializing storekit
< {cancelled: function, failed: function, completed: function, finished: function}
INFO: ios -> storekit ready (cordova.js, line 1413)
DEBUG: ios -> loading products (cordova.js, line 1413)
I have the same problem, can anyone help us?
I think this is the same issue as https://github.com/j3k0/cordova-plugin-purchase/issues/1248. Having the same problem here.
This is an issue I too am experiencing - only on live/production version unfortunately, testflight works as expected.
I am having same issue, where testflight works fine and order button does not work on live/production. What I have noticed is that if I click the button leave it sitting for 3 to 4 minutes then it starts working, not sure what is causing it but hard to debug when testflight works and production is showing issue
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
same problem
Same problem
Context
I was having this issue since I upgraded the plugin from 7.4.3 to 10.x : no purchase (consumable or non-renewing) made on production app in Apple Store, for almost a year.
The problem is also related to #1155, #1248 at least.
It concerns a lack of validator
implementation (my case).
Problem
What was working after plugin upgrade :
- IAP on Android in dev App
- IAP on Android in production App
- IAP on iOS in dev (sandbox) App after the first installation from xCode
What was not working after plugin upgrade :
- IAP on iOS in dev App without reinstalling after a 1st purchase
- IAP on iOS in production App
What parts of the API doc lead me to think my initial user code (see below) should work after the plugin upgrade :
Some unthoughtful users will try to use fake "purchases" to access features they should normally pay for. If that's a concern, you should implement receipt validation, ideally server side validation.
and
Anecdotally, non-renewing subscriptions are easier to implement and test than auto-renewing subscriptions, because you don't need to deal with receipt validation or wait hours for test subscriptions to expire
To my understanding, implementing a validator
was not mandatory.
In fact, since a purchase of my IAProduct has to be valid on Apple, Android and Web platforms, I had already created a sort of master-validator. So I thought I don't need to use/write a platform specific one.
Solution
// old user-code (compatible till IAP plugin 7.4.3), found in the API doc:
store.when("product").approved(function(p) {
p.finish();
});
// in conjunction with the default plugin code:
store.validator = null;
does not work and has to be replaced by:
// new user code for IAP plugin 10.x+
store.when("product").approved(function(p) {
p.verify();
});
store.when("product").verified(function(p) {
if ( p.type != 'application' ) {
p.finish();
}
});
// in conjunction with a user "fake"`validator` :
store.validator = function(product, callback) {
callback( true, product ); // always success!
}
Hope it helps !