vendure
vendure copied to clipboard
Payment cancellation
Is your feature request related to a problem? Please describe. Current implementation of 'cancel' payment state is like a dummy. I can cancel payment from any state, so its gonna be a problem if payment is in 'authorized' or 'settled' state and I click cancel in admin-ui. Literally we may lose payments, without any callback to payment provider.
Describe the solution you'd like A new payment handler's method 'cancelPayment' which carefully handle this type of transition. In two-step scheme we could cancel payment transaction, which will unblock held funds, instead invoking a refund.
Describe alternatives you've considered Handle this type of action as refund, but I guess there is a lot of side effects on order.
@michaelbromley Hi, I think you are right - currently it's just setting state to Cancelled and no side effects are happening. It should not really be possible to just cancel a settled payment - you'd also want to take the corresponding action with the payment provider like with "refund".
So I think basically I added this state way back when I implemented Payments but before actually having implemented a concrete provider integration, hence this rather impractical functionality.
@ashitikov It's quite helpful in case of two-step payment flow Transition authorized -> cancelled is possible in this case. Corresponding method cancelPayment should be called in payment handler in this case
@michaelbromley yes, then we'd need to add a cancelPayment method to the handler API.
Slack thread: https://vendure-ecommerce.slack.com/archives/CKYMF0ZTJ/p1656319311851299