verygoodsecurity / vgs-collect-js

VGS Collect.js script loading module
https://www.verygoodsecurity.com/
7 stars 14 forks source link

Remove card brand support? #73

Closed AndrewGold closed 7 months ago

AndrewGold commented 8 months ago

Hello - I see in the documentation there is a way to add new card brands or redefine support for existing card brands. Is there a way to remove support for some card brands?

Thanks!

flor-master commented 8 months ago

hi, yes you can set only acceptable card brands like this:


const cardNumberLimitedBrands = f.field('#cc-number-limited-brands .fake-input', {
      type: 'card-number',
      name: 'card-number-limited',
      validations: ['required', 'validCardNumber'],
      addCardBrands: [
        {
          type: 'testCard',
          pattern: /^123/,
          format: /(\d{1,4})/g,
          length: [16],
          cvcLength: [3],
          luhn: true,
        }
      ],
      validCardBrands: [{ type: 'amex' }, { type: 'testCard' }]
    });
AndrewGold commented 8 months ago

Thank you!