Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a correct way to mask a 15 digit credit card number?

15 digit bank card numbers are formatted 0000-000000-00000[1].

If I show the last 4 digits, it becomes xxxx-xxxxxx-x0000 which looks slightly goofy.

Is there a correct way to format a masked 15 digit number?

(I expect we will not show more than the last 4 anyway, but if there is a standard, I want to know about it.)

like image 275
700 Software Avatar asked Sep 28 '11 21:09

700 Software


People also ask

How do I mask a credit card number?

Use 4 issuer digits. The first four digits of the credit card number are copied from the source to the output. The remaining part of the credit card number is appended with the masked account number and a check digit. A check digit is a digit added to a number that validates the authenticity of the number.

Can you have a 15 digit credit card number?

Credit cards linked to major payment networks like Visa, Mastercard and Discover have card numbers that are 16 digits long. American Express credit cards, on the other hand, have 15 digits.


1 Answers

There is no standard really. The vast majority of sites display the last four with four X's in front them whether the credit card number is 15 or 16 digits so that would probably be the most recognizable to your users. But if you really want to format it so you show the actual structure of the card number then do it as xxxx-xxxxxx-x0000 despite the goofiness. Users may find showing an extra character (xxxx-xxxxxx-00000) is "unsafe" and I'm sure you don't want to give anyone an opportunity to complain or do a chargeback.

like image 169
John Conde Avatar answered Feb 23 '23 23:02

John Conde