Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.43k stars 1.99k forks source link

Checkout: American Express credit card numbers aren't formatted correctly during checkout #21924

Closed lancewillett closed 6 years ago

lancewillett commented 6 years ago

Steps to reproduce

  1. Starting at URL: https://wordpress.com/checkout/example.wordpress.com/personal
  2. Try to purchase a Personal plan on a your site
  3. In the checkout form, add an Amex number (instead of Visa or Mastercard)
  4. Note the expected format is visually incorrect, leading to confusion for customers trying to verify their card number before submitting it

What I expected

To see American Express card number format respected: 1234 123456 12345.

What happened instead

It looks like we only format in groups of 4 for all card types, so an Amex number ends up displaying in the form field like this: 1234 1234 5612 345

Screenshot / Video

screen shot 2018-01-29 at 08 24 04

Context / Source

Source: @m #flowsharing via a friend of his in #reallife

gwwar commented 6 years ago

Huh, some credit cards may have up to 19 digits. I think the grouping for these is 4-4-4-remaining digits. I couldn't verify what the grouping is for diners with 14 digits. I'll assume 4-4-4-2 unless folks know otherwise.