-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
What happens
When there is a confirmation step in the order flow, i.e. the payment is not the last step in the flow, there can be a situation where there are multiple pending payments for the order. This is blocking users to checkout with payment providers who only accept a single authorized payment (Affirm for example). Also, with this there is a possibility to have multiple pending payments on a creditcard. This will not block the user to finish the checkout, but does have a negative impact.
The problem
When working with payment providers (PSP) who need a redirect, for example Mollie, Affirm, Paypal etc. We currently create a Payment instance, redirect to the PSP and handle the response with a callback url. This usally is checking the payment state and amount with the PSP Api and redirect the user to the order complete or order confirm page.
When the payment is the last step of the order process, this has minimum impact. The payment is done and the order is marked as completed. There are edge cases known that also create multiple payments. Fixing that is not the main goal with the RFC, but the assumption is that this will has a positive impact on those edge cases too.
When the order has a confirmation step and the user changes the order and checks out again, we create another payment and redirection. This can cause problems with creditcards and Affirm (and alike) payments. The authorization of a credit card for example is usually a hold on the card. When checking out multiple times with multiple pending / authorized payments on a card can cause problems with the user's card balance.
related input: solidusio/solidus_affirm#58 (comment)
Solution
Introduce a (configurable) handler class that is responsible for handling canceling pending payments in the checkout process.
Working on a PR to have some code around this, want to have this RFC out here as well to have a discussion around this.