Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
173 stars 69 forks source link

Incorrect ZIP code error message confuses customers #2602

Closed billrobbins closed 2 years ago

billrobbins commented 3 years ago

When an order fails ZIP code validation, there is an error message telling them to update the ZIP code. Sometimes users update the shipping ZIP code since the error doesn't specify. It would be great to clarify that the billing zipcode failed validation so it's not confusing to users.

Markup 2021-07-27 at 20 19 56

4178877-zen

jrodger commented 3 years ago

I've seen a few instances of the confusion this error message can cause, so I was going to give it a high priority but I don't think it quite hits that threshold.

@jarekmorawski, I was wondering if this might be a good issue to consider as part of your work on error messaging? Or where you focusing more on the error messages the merchant seeing in the admin dashboard?

jarekmorawski commented 3 years ago

👋 Thanks for the ping, @jrodger. Indeed I'm currently focusing on the error notes in the admin dashboard, but if this message is confusing customers, it's definitely a problem worth solving ASAP.

To be clear, is this error caused by merchant's account blocking purchases with a failed zip code check? I tested it on my site, but the only error I'm getting is:

Billing ZIP is not a valid postcode / ZIP.

The transaction goes through even when the zip code check fails.

As for the error note itself, is it handled by Stripe? If not, perhaps we could change it something like this (inspired by this support doc):

We couldn't verify the postal code in your billing address. Make sure the information is current with your card issuing bank and try again.

jrodger commented 3 years ago

Thanks for taking a look @jarekmorawski. Where are you seeing the "Billing ZIP is not a valid postcode / ZIP" error message?

The transaction goes through even when the zip code check fails.

I think this is a difference in behaviour between test mode and live mode...which is annoying. I'll try and track down why we seem to be getting different behaviour.

jarekmorawski commented 3 years ago

Where are you seeing the "Billing ZIP is not a valid postcode / ZIP" error message?

On checkout (red notice about all the fields) when I purposely enter an incorrect postcode.

jrodger commented 3 years ago

Ah, got it, thanks.

That explains the difference between the 2 messages then. The " is not a valid postcode / ZIP" comes from WooCommerce core here.

So to answer your original question, yes, the error in the screenshot should be the error that Stripe returns when there was an issue checking the ZIP code....I just can't replicate it right now.

geektzu commented 3 years ago

@jrodger

Looks like the error message could be from:

Line: 1166 or 1201 wc_add_notice( $message, 'error', $data );

Definition of wc_add_notice found from https://woocommerce.wp-a2z.org/oik_api/wc_add_notice/ function wc_add_notice( $message, $notice_type = 'success', $data = array() ) { if ( ! did_action( 'woocommerce_init' ) ) { wc_doing_it_wrong( FUNCTION, __( 'This function should not be called before woocommerce_init.', 'woocommerce' ), '2.3' ); return; }

$notices = WC()->session->get( 'wc_notices', array() );

// Backward compatibility. if ( 'success' === $notice_type ) { $message = apply_filters( 'woocommerce_add_message', $message ); }

$message = apply_filters( 'woocommerceadd' . $notice_type, $message );

if ( ! empty( $message ) ) { $notices[ $notice_type ][] = array( 'notice' => $message, 'data' => $data, ); }

WC()->session->set( 'wc_notices', $notices ); }

I think we just need to add a filter:

Like the reverse of this https://wordpress.org/support/topic/how-to-remove-billing-from-checkout-page-error-messages/

leonardola commented 3 years ago

Hi there, I could not simulate the error. Can you please post some more details on how to get this error?

Error: The zip code you supplied failed validation?

All I can see is this one:

Billing ZIP Code is not a valid postcode / ZIP.

Steps taken:

I've tested both UPE and regular checkouts

The reported error seems to be generated here: https://github.com/Automattic/woocommerce-payments/blob/develop/includes/wc-payment-api/class-wc-payments-api-client.php#L1388

One solution would be to change Error: to Billing Error: or Payment Error: as this is the only part of the message we can control

jrodger commented 3 years ago

Can you please post some more details on how to get this error?

The issue is to do with the ZIP code not matching the provided card details, as opposed to the code just being in the wrong format or not existing.

In a live environment this is pretty easy to simulate, just put in the wrong address for your card. However, I'm struggling a little bit to replicate this in a test environment. We can use Stripe's test cards, I think 4000000000000010 is the one we want. I just haven't been able to replicate the correct account setup to get it failing.

jessLundie commented 2 years ago

Hi @jarekmorawski - I wanted to mention this here, since you noted that you are focusing on internal error messaging.

We had this come up in another form in 4389983-zen. In this case, an order failed with the Error: The zip code you supplied failed validation error.

However, in the order notes, they were not able to see anything about this failure. The order remained in Pending, but the issue wasn't exposed on the merchant side in any way. We are able to see it in the Stripe Express view for the merchant, but they are not.

Please let me know if you are using a different issue to track improving the internal error messaging. I didn't see any open issues that seemed to fit, but can move this comment somewhere else if there's a more appropriate place for this!

jarekmorawski commented 2 years ago

Hi @jessLundie! Thanks for the ping. I've reached out to Stripe's support a couple of weeks back and got an inconclusive answer. @mordeth, did you manage to collect more details on this issue?

mordeth commented 2 years ago

Hi, @jessLundie and @jarekmorawski. I was able to replicate the error on my test site by enabling the blocking payments that fail postal code validation setting for my account.

I will create a PR to change the error message to Error: The billing ZIP code you supplied failed validation. on the checkout page, should we update it on the order notes also?

@jessLundie if the payment failed with the above message I can see the error in order notes. I suppose we should create another issue for the case you described?