Open alexp25 opened 6 months ago
It works for me if I use the numeric error code:
store.order(...).then(error => { if (error) { console.log("Store error " + error.code + ": " + error.message); if (error.code === 6777006) { // Purchase flow has been cancelled by user console.log("User cancelled"); } else { // Other type of error, check error.code and error.message } } });
Tried this but it doesn't resolve the promise at all - there is no output when a purchase is cancelled. Is there some other way to detect product-related errors? The store.when(product).error
method is no longer available..
That's the only way it gives in the migration guide: https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO:-Migrate-to-v13#detecting-failed-purchases
Maybe try setting the debug level to verbose and see if that gives any more clues:
store.verbosity = store.DEBUG;
Current behavior:
The new version of this plugin does not detect failed purchases (e.g., cancelled purchase, declined, etc.)
The documentation states that the .error event was removed and can be detected by using the following code instead:
"To check for failed purchases, store.when("product").error() does not have a replacement in v13: you should now check for an error returned by the store.order()"
However, the error is never triggered and the purchase flow is left hanging.
Expected behavior:
Detecting failed purchases To check for failed purchases, store.when("product").error() does not have a replacement in v13: you should now check for an error returned by the store.order() promise (API Doc).
The purchase error should be detected.