cordova-plugin-purchase icon indicating copy to clipboard operation
cordova-plugin-purchase copied to clipboard

Cancel purchase process trigger

Open sergip76 opened this issue 1 year ago • 4 comments

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(() => { });

sergip76 avatar Feb 08 '24 16:02 sergip76

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
    }
  }
});

reinos avatar Feb 15 '24 11:02 reinos

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 avatar Feb 26 '24 07:02 sergip76

@sergip76 Did you find a solution to this? I've been struggling with the same issue, namely reacting to user closing the payment modal.

mvaljento avatar Jun 05 '24 07:06 mvaljento

@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 :-(

sergip76 avatar Jun 05 '24 08:06 sergip76