cordova-plugin-purchase
cordova-plugin-purchase copied to clipboard
Cancel purchase process trigger
Is it possible to know when a purchase has been cancelled? I mean that the user clicks on buy and once the purchase screen appears go back to cancel the process before making the purchase.
It would be something like this:
CdvPurchase.store.when().cancelled(() => { });
Its not really in the documentation but your could use this
https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO:-Migrate-to-v13#detecting-failed-purchases
store.order(...)
.then(error => {
if (error) {
if (error.code === CdvPurchase.ErrorCode.PAYMENT_CANCELLED) {
// Purchase flow has been cancelled by user
}
else {
// Other type of error, check error.code and error.message
}
}
});
Its not really in the documentation but your could use this
https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO:-Migrate-to-v13#detecting-failed-purchases
store.order(...) .then(error => { if (error) { if (error.code === CdvPurchase.ErrorCode.PAYMENT_CANCELLED) { // Purchase flow has been cancelled by user } else { // Other type of error, check error.code and error.message } } });
I was referring to the moment when the user simply closes the payment window, not when the payment is cancelled. If the user closes the payment window no error is thrown.
@sergip76 Did you find a solution to this? I've been struggling with the same issue, namely reacting to user closing the payment modal.
@sergip76 Did you find a solution to this? I've been struggling with the same issue, namely reacting to user closing the payment modal.
Sorry, I have not found any solution :-(