-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use deferred intents on the Pay for Order page #2801
Use deferred intents on the Pay for Order page #2801
Conversation
…dling that is not used
…t to a hidden input
…ew WC_Payment_Token to the user
…at don't support 0 amounts + setup intents
…uire actions if neededC
…o the wc callbacks have been attached
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix @james-allan !!
I've tested the following flows/cases on this PR and didn't find any issues:
- Confirm intent isn't created on pay for order page load
- Pay for an order with a success card
- Pay for an order with a fail card (confirmed error was present)
- Pay for an order with a 3DS card (
4000000000003220
) - Pay for an order with a 3DS card and fail the auth check
- Pay for an order with Auth and Capture turn on/off
I couldn't test with a non-credit card like SEPA (pending order goes on-hold instead of processing, but I'm assuming this will addressed by #2772 ?
The other thing I noticed while testing this PR is when you use a failed card like 4000000000009995
, you see the correct error message on the checkout, but if you then refresh the page and resubmit the form, you see the following:
I couldn't reproduce this on develop
so I'm not sure if this is something we should fix now or fix it later as I don't think it's related to this PR specifically.
My guess is we need to do something like clear the form on submit or something so that when we display an error, the same form can't be resubmitted by the customer.
I think that's intended. SEPA is a direct debit kind of payment method so can take up to 6 days to confirm. Having said that if I view the payment in the Stripe dashboard it is complete and confirmed which is probably a test mode thing. I'm going to test on a JN site to rule out a webhook issue.
I cannot replicate this. Were you resubmitting the form after the original failure with a different card or the same failing card? |
Aha! Yeah you're right, I think it might be setup/webhook related. With #2803 merged, I tested another UPE method like giropay and can confirm the Pay for Order page works correctly.
Yeah, after landing on the checkout page with the error message, I'm refreshing the page and pressing "Continue" on the resubmit option. Here's a recording: Screen.Capture.on.2024-01-02.at.14-21-45.mp4 |
Ah thanks I can replicate this error now. When I try replicate on develop the page doesn't attempt to resubmit the form at all, the page just refreshes. The checkout page works the same so I'm going to look into how I can replicate that kind of behaviour here too. |
So I've been able to prevent the resubmit popup after a failure but to achieve that I needed to put in a redirect at the end of the eg @@ -742,6 +742,11 @@ class WC_Stripe_UPE_Payment_Gateway extends WC_Gateway_Stripe {
sprintf( __( 'Payment failed: %s', 'woocommerce-gateway-stripe' ), $e->getLocalizedMessage() )
);
+ if ( isset( $_POST['wc-stripe-is-order-pay'] ) ) {
+ wp_safe_redirect( $order->get_checkout_payment_url() );
+ exit;
+ }
+
return [ 'result' => 'failure' ];
}
} This works, however I'm not sure if it's the right approach because that cuts the request short and prevents the rest of the So I'm a little stuck now on how we want to proceed here. The reason this doesn't happen on Given WooPayments works the same way as this branch with a different error message, what are your thoughts on leaving this as it is. I have a feeling that this would affect all similar payment methods and WC could resolve it by changing the |
I think this is a reasonable way forward. Thanks for looking into this @james-allan Approving this one for merge! |
Fixes #2766
Changes proposed in this Pull Request:
This PR utilises the changes introduced in
add/my-account-add-card-with-deferred-intent
to add the deferred intent payment elements to the Pay for Order page.These payment elements are the same ones used on the classic checkout.
Testing instructions
issue/2766-deferred-intent-pay-for-order-m2
) and re-build
Other tests
SCA/3DS
Alternative payment methods
Because these payment elements use the same ones implemented in the original classic checkout PR, it's still a unified payment element and all alternative methods appear like this:
Auth and capture
changelog.txt
andreadme.txt
(or does not apply)Post merge