feat(payment): Stripe OCS, make payment validation request non-blocking - #3381
Open
PavlenkoM wants to merge 1 commit into
Open
feat(payment): Stripe OCS, make payment validation request non-blocking#3381PavlenkoM wants to merge 1 commit into
PavlenkoM wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 3bbac19. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

What/Why?
After a successful client-side Stripe confirmation, the Stripe CS and OCS payment
strategies send a second
submitPaymentrequest so the backend can validate thepayment and finalize the order. This round trip can be slow, and the shopper is kept
waiting on a payment that Stripe has already confirmed.
This PR adds an optional
asyncPaymentValidationflag toStripeInitializationData.When enabled, both strategies send the second
submitPaymentrequest without awaitingthe response and resolve
execute()immediately, letting checkout proceed to orderconfirmation. Errors from that request are intentionally ignored (
.catch(noop)): thepayment is already confirmed on the Stripe side, so the order status is reconciled by
Stripe webhooks even if the validation request fails or doesn't complete.
Only the success path is affected. Declined/failed Stripe confirmations behave exactly
as before: the error-status update request is still awaited and the error is thrown to
the shopper.
Rollout/Rollback
initializationData, gated by thePROJECT-8987.ocs_async_payment_validationexperiment. The backend sends
asyncPaymentValidation: trueonly when the experimentis enabled for the store and the merchant has Stripe webhooks configured — since
webhooks become the finalization path whenever the non-blocking request doesn't
complete (e.g. interrupted by the redirect to order confirmation), stores without
webhooks never receive the flag.
Testing
Stipe OCS + Checkout Session
Before:
Screen.Recording.2026-08-28.at.12.04.59.mov
After:
Screen.Recording.2026-08-28.at.12.13.39.mov
Stripe OCS + Payment Intent
Before:
Screen.Recording.2026-08-28.at.11.57.47.mov
After:
Screen.Recording.2026-08-28.at.12.01.36.mov
Note
Medium Risk
Changes post-confirmation payment finalization timing; when enabled, order completion may depend on webhooks if the background validation request fails.
Overview
Adds optional
asyncPaymentValidationonStripeInitializationDataso Stripe Checkout Session and OCS (Payment Intent) strategies can finish checkout without waiting on backend validation after Stripe confirms the payment.When the flag is true and confirmation succeeds, both strategies still issue the second
submitPayment, but they fire-and-forget it (submitPayment(...).catch(noop)) andexecute()resolves immediately. Declines and other Stripe error paths are unchanged—they still await error-status updates and surface failures to the shopper.When the flag is false or unset, behavior stays the same: the second
submitPaymentis awaited, and failures still trigger the existing “proceed” / error handling (including CS paid-session handling).Unit tests cover flag-on (non-blocking, ignored second-request errors) vs flag-off (await and propagate errors) for CS and OCS.
Reviewed by Cursor Bugbot for commit 3bbac19. Bugbot is set up for automated code reviews on this repo. Configure here.