[Split PE] Fix errors on checkout caused by attempting to reuse intents that require action or require manual confirmation #2952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2950
Changes proposed in this Pull Request:
In #2845 we implemented reusing payment intents that have been stored on the order, however, this throws the following error for payment intents with
requires_action
andrequires_confirmation
statuses:requires_action
status are used for 3DS cards and UPE payment methods that redirect the customer off-site have this statusrequires_confirmation
status are from purchases with Boleto and OXXO vouchers as we manually confirm the intent on checkout to show the voucher to the customerThis PR fixes this issue by making sure we create a new intent when the one stored on the order requires action, instead of trying to update and confirm the intent.
Ideally, we could still reuse these payment intents that require action/confirmation and just don't attempt to confirm them via the Stripe API (only update the intent data), but when I tried to implement this I ran into further errors from Stripe. I think one of them had something to do with not being able to send a
return_url
to the/payments_intents/{id}
endpoint. For the sake of fixing this issue I opted for the more simple approach at this time.Testing instructions
With a 3DS card
4000000000003220
4000000000003220
With a UPE redirecting payment method
https://woo.local/checkout
)changelog.txt
andreadme.txt
(or does not apply)Post merge