Closed martijnvdbrug closed 2 years ago
Hey @martijnvdbrug, maybe the solution to this is to re-think the payment flow slightly. The upcoming stripe plugin (#1417) does it like this:
createStripePaymentIntent
rather than addPaymentToOrder
This flow gets around this whole issue, since the Order has not been transitioned to PaymentAuthorized or PaymentSettled until the actual successful transaction comes back. I also feel that this conceptually maps to what is going on a bit better.
What do you think?
That is a nice solution indeed.
Only downside I see is that the ArrangingPayment state is not used, and it's nice see how many users left after ArrangingPayments. BUT, thats not what the states are for I guess.
I think we can close this one. I opened a new issue for updating the Mollie plugin: https://github.com/vendure-ecommerce/vendure/issues/1432 I can work on this :arrow_up:
Is your feature request related to a problem? Please describe. With Mollie payments (and Stripe similar I believe), the payment flow is as follows:
handler.createPayment()
is called by the client.Before the handler can return the redirectLink, we need to return a payment state. The 'earliest' state we can send is
Authorized
, resulting in the order becomingPaymentAuthorized
However, a client can leave the external platform, for whatever reason: cancel, expire, failed payment. Whenever the user returns to the storefront, the order will be stuck in
PaymentAuthorized
, with no way back toAddingItems
Describe the solution you'd like The order should be able to return to
AddingItems
after a customer leaves the payment platform. The logical way is to keep the order inArrangingPayment
while the user is on the external platform. From there we can:PaymentSettled
if payment succeedsAddingItems
if the payment fails, expires or is canceledDescribe alternatives you've considered I currently detect any
PaymentAuthorized
orders and discard them on the frontend. The customer is forced to recreate the order.Additional context