jondavidjohn / payform

:credit_card: A library for building credit card forms, validating inputs, and formatting numbers.
https://jondavidjohn.github.io/payform/
Other
427 stars 81 forks source link

Bancontact (BCMC) credit card support #69

Open gmoulin opened 3 years ago

gmoulin commented 3 years ago

Hello,

I tried to use the information on how to add a "custom cards" validation but I must be missing something.

I am trying to add Bancontact support.

Cards number example:

CVC: none Not sure about the length, I found 13 to 19 in some other validators.

Here is the code I am using to add the card declaration.

window.payform.cards.push({ // Card type, as returned by payform.parseCardType. type: 'BCMC', // Regex used to identify the card type. For the best experience, this should be // the shortest pattern that can guarantee the card is of a particular type. pattern: /^6703/, // Array of valid card number lengths. length: [13,14,15,16,17,18,19], // Array of valid card CVC lengths. cvcLength: [0], // Boolean indicating whether a valid card number should satisfy the Luhn check. luhn: true, // Regex used to format the card number. Each match is joined with a space. format: /(\d{1,4})/g });

By default, Bancontact cards are matching Maestro cards, but that's not OK because of the CVC at the least.