woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
237 stars 207 forks source link

Selected payment method and bank account not preserved on failure #1989

Closed waclawjacek closed 5 months ago

waclawjacek commented 3 years ago

Describe the bug

If a transaction fails, customer is redirected back to checkout page but selected payment method is not preserved.

In addition to that, the bank account number is also not preserved when paying with SEPA.

With pre-UPE checkout, the selected payment gateway is preserved (didn't test with bank account).

Expected behavior

Selected payment method and bank account number are preserved.

Screenshots

https://d.pr/i/BkwmCe

In the GIF, there is a saved card but this happens regardless of whether you have a saved card.

Environment (please complete the following information):

WC Stripe 5.6-test

frosso commented 3 years ago

I also noticed this, I think it would be a nice feature to have for customers, in case the payment method fails multiple times 👍

EvanDotPro commented 3 years ago

Unfortunately, I'm fairly certain that Stripe does not currently provide a way for us to hint which method should be pre-selected within the UPE, nor what values to pre-populate the inputs with.

wjrosa commented 5 months ago

Unfortunately, there's no onChange event for [Elements](https://docs.stripe.com/stripe-js/react#elements-provider) from React Stripe JS. This is available only for standalone payment elements. My idea here was to use it to grab the last selected element and reorder the list of methods based on that, keeping that method as the first on the list (and pre-selected). Since it looks we can't do this change, I will be closing the issue.