Credit Card validation with Jquery

前端 未结 3 1054
情深已故
情深已故 2021-01-06 00:09

I\'m trying to validate credit card numbers with jQuery but i dont want to use the validation plugin , is there any other plugin for doing this?

3条回答
  •  独厮守ぢ
    2021-01-06 00:57

    If you want to be certain that its a valid card number, you'll need to check much more than the Luhn digit.

    The Luhn digit is only intended for checking transposition errors, and can easily be spoofed with numbers such as 22222222222222222

    The first six digits of the card number should be checked. These digits are known as the issuer identification number, and can be used to ensure that the number is within a recognised range. Unfortunately you'll struggle to find a comprehensive list of IIN's, not least because issuers are constantly adding and removing ranges. Wikipedia has a very basic overview though: Bank card number

    If you can determine the card type from the IIN, you can then have a stab at validating the length of the number also.

    Unless you have very good reason, its much easier to use something like a validation plug-in.

提交回复
热议问题