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
Source: stackoverflow.com
Related Query
- Stripe Elements - Restrict certain card types
- Is there a way to restrict params to certain values while using react-router?
- How do I add a custom font to my Card Element when using React Stripe Elements?
- Is there any stripe element to display a saved card to user.?
- Stripe reactjs - could not find elements context
- How can I restrict MUI TimePicker to allow only certain times?
- How to properly set colors on certain elements in Material-ui?
- Stripe payment method. Use card [split-form] not working. Can't get card number expiry and cvc number
- How to solve Stripe elements for react causing memory leak on redirect
- How can I format my CSS and Bootstrap so that only certain elements wrap when page width decreases?
- How can I show certain elements from an array based on a React State?
- How to skip certain elements when using javascript map()
- Stripe Card Element default postcode
- how to change the color of childs elements on card hover in material ui?
- How to reload stripe elements according to different API keys?
- How to horizontally align card elements (rmwc) in React?
- Stripe - how do I save card element in react?
- React Stripe Elements - set width to auto for iFrame? Elements invisible inside grid and modal
- How to hide/show elements at certain breakpoints with Material UI?
- React Stripe Elements & SSR - Webpack Error: Window is Not Defined
- Looping through certain elements in React
- From list of elements set opacity to 0 if its a certain tag
- Error with React Stripe split card elements: Maximum update depth exceeded
- Add stripe elements multiple publishable keys in ReactJs
- How to order an array by keeping certain elements always on top
- How can i restrict user from not selecting other file types using input type file with react and typescript?
- How to assign types of (typeof) all elements in the object to a variable in JavaScript | Typescript?
- How to display certain elements of a list as sticky elements without adding any hierarchy in rendering?
- Numerate certain elements uniquely in react redux
- React: Remove certain html elements from string and normalize
More Query from same tag
- React Material UI withStyles pass parameters to withStyle object
- Hi guys, how do i show the users name on the navbar once they have logged into onto the website?
- ReactJS - how change html markup dynamically?
- How to organise exported components from own React library
- How to pass JS variables to JSX files
- Unable to render two-level deep nested object with map
- Ref on svg <path /> doesn't have "getTotalLength()"-Method
- How can i display flags as option in a select
- How to use Material UI "Progress Indicator" between two set dates?
- Why am I not routing through the Switch? React Router v4
- How to prevent function from repeating items into an array of objects in ReactJS?
- Infinite Loop When Using Hooks in React
- Adding custom Typescript type declaration for a node module in Create React App
- React Error: "SharedArrayBuffer is not defined" in Firefox
- Access MobX state outside of React Components?
- How can I replace screen with React Navigation for React Native
- Default props with wrapped Styled Component in Typescript
- Authenticate user in spring boot with react login form
- React UseContext causes errors
- React single landing page with components
- How do I map an array of objects with react
- React.js - TODO List edit button not working
- I am new to reactjs - looking to add some conditional class that come into action
- React Native - Return all JSON data in AsyncStorage?
- How to add an event listener to useRef in useEffect
- Problem with Axios and onClick - React JS
- How to pass argument from component to redux action
- View wont update but the URL does in React Router V6
- How render specific data from axios call in Reactjs
- Use map to create HTML ReactJS