This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
Improve Payment Methods integration API so either onPaymentProcessing
event fires for savedTokenHandler components or onCheckoutBeforeProcessing
allows updating POST
#3980
Labels
block: checkout
Issues related to the checkout block.
category: extensibility
Work involving adding or updating extensibility. Useful to combine with other scopes impacted.
I was notified by the Square payment integration team (hi @mattallan 👋 ) that their saved token handling works a bit differently than the payment method integration API assumes and requires the ability to get the 3DS verification token before the initial checkout submission. The current
onCheckoutSuccessAfterProcessing
event won't work here because the Square extension still needs to process this buyer_verification_token server side after the authorization (to create the payment) and currentlyonCheckoutSuccessAfterProcessing
will not have a path that re-submits to the server unless there is an error andretry
is true. That ui/ux workflow won't work for the Square needs here.Options
There are a few options that will resolve Square needs here:
1. Provide a way for
onCheckoutSuccessAfterProcessing
callbacks to trigger doing aresubmit
to the checkout server.This scenario would expose a way for handlers to indicate they've updated something in the checkout that requires a resubmission to the server for re-validating whatever was updated.
Pros:
setComplete
action (but only if! shouldRetry( response)
- which is kind of odd here, because the state won't get used anywhere in this scenario).Cons:
2. Expose
onPaymentProcessing
event for checkout submission including savedPaymentTokensThis scenario would refactor the existing flow so that the
onPaymentProcessing
event fires as a part of saved tokens being included in the checkout submission.The reason it doesn't currently is because the assumption was made in the design that if there is a saved token, that means there is no client side payment processing needed, and thus the payment status for a saved token is
SUCCESS
(which is a status saying client side payment processing completed successfully).Pros:
Cons:
onPaymentProcessing
event. However, I think we could resolve this by simply having a default handler set for saved tokens that don't have one explicitly defined. Alternatively (which might be better), when theonPaymentProcessing
event goes through all the subscribed observers, and the PAYMENT_STATUS has not been updated to success, we could trigger the update to success so that checkout proceeds (probably should be doing this anyways if we're not).3. Allow for updating the checkout state with the
onCheckoutBeforeProcessing
event.Currently this event doesn't impact any updating of state (other than validation/error state) and is mostly used for initial checkout form validation. With this option, we'd also allow updating more of the state (in both contexts, when checkout returns to idle, and when checkout is set to Processing).
Pros:
Cons:
onCheckoutValidationBeforeProcessing
to make the event more clear (we could deprecate the old event function and just redirect to the new name).What do do?
I'm leaning towards Option 2 here because that seems like the most optimal improvement that resolves this situation AND also preserves the original intent behind the design of the flow. It also helps ensure anything to do with Payment methods in the checkout flow behaves consistently (event saved tokens) where if there is some form of payment method, the
onPaymentProcessing
event will always fire.As an aside, I also think it be a good idea to rename the
onCheckoutBeforeProcessing
event toonCheckoutValidationBeforeProcessing
.The text was updated successfully, but these errors were encountered: