Skip to content

Some valid payment card numbers are not accepted #1559

Open
@dspinellis

Description

@dspinellis

The performed check is overly stringent (and sometimes wrong) regarding the accepted formats. The following illustrates two cases derived from this site.

> const validator = require('validator');
> validator.isCreditCard('4716967026053481241') // OK; Visa
true
> validator.isCreditCard('6396827370876380') // Not OK; Maestro
false
> validator.isCreditCard('5020198842623966') // No OK; InstaPayment
false

More details on number formats are available here, here, and here. I think the correct validation approach would be to check the length of known issuer identification numbers (IINs) and for the rest, accept numbers with 12–19 digits that have a valid Luhn checksum. I'll try to provide a fix, and would welcome any comments regarding this approach.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions