score:1

you can check the brand field from the change event of the stripe element. for example this : https://jsfiddle.net/nwyf587t/ blocks american express cards in vanilla js.

https://stripe.com/docs/js/element/events/on_change?type=cardelement https://stripe.com/docs/js/element/events/on_change?type=cardelement#element_on_change-handler-brand

card.on('change', function(event) {  
  if (event.brand === 'amex') {
    errorelement.textcontent = 'american express cards are not supported.';
    errorelement.classlist.add('visible');
    paybuttonelement.disabled = true;
  }
});

note that this is only ever going to be a client-side check and theoretically it coud be circumvented if the user really wanted to using their browser devtools. you could use radar rules in stripe to block payments entirely https://stripe.com/docs/radar/rules/reference


Related Query

More Query from same tag