Skip to content

Possible need to update card brand regex #662

@Leviosar

Description

@Leviosar

I was trying the lib with a card and despite being issued by Mastercard it didn't get recognized. The card is a mastercard platinum issued by a Brazilian bank and starts with "2235 25" and can be found using any online BIN validator.

According to the mastercard bin table available at https://www.mastercard.us/en-us/business/issuers/get-support/simplified-bin-account-range-table.html those cards are ranged from 2235250000 to 2235259999. Also it looks like there's a lot of banks using 223 prefix for mastercard.

I've checked the code that does this parsing and i believe the regex currently used for mastercard is /^(5[1-5]|677189)|^(222[1-9]|2[3-6]\d{2}|27[0-1]\d|2720)/g and changing it to /^(5[1-5]|677189)|^(222[1-9]|2[2-6]\d{2}|27[0-1]\d|2720)/g would fix it.

Is the lib still being updated with card formats? I could make a PR if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions