card icon indicating copy to clipboard operation
card copied to clipboard

How to get the card type (visa, mastercard, etc.) so I can pass that info to payment gateway

Open frankkreutzer opened this issue 2 years ago • 5 comments

I'd like to be able to pass the card type as we want to display it later on.

frankkreutzer avatar Feb 16 '23 22:02 frankkreutzer

not sure if this is still relevant but for people with the same question: you can use the bin of the card to decode if it's type, the bin is the bank identification number of each card and it identifies a card down to the bank which issued it, with a BIN API like the one from binlist.io you are easily able to check which card goes with which card type.

03lenio avatar May 18 '23 19:05 03lenio

I noticed there is an inbuilt payment library which documents the APIs available.
You don't need to download the library to use it.
In my case:

Form field <input type="text" id="card-number" class="form-control" placeholder="0000 0000 0000 0000" type="tel" name="number">

Get type

$("#button-confirm").click(function() {

        var type= Payment.fns.cardType($('#card-number').val())
        console.log(type)
}

ovicko avatar Jun 16 '23 13:06 ovicko

$('#someTextBox').change(function() { $('#someOutput').text(creditCardTypeFromNumber($(this).val())); }); This will output into some element with id="someOutput" the result of the text box which fires when the user changes the text in the element id="someTextBox".

Almansori avatar Nov 24 '23 09:11 Almansori

How to check for username and password correct logins to a credit card site...to provide details

111fast avatar Aug 03 '24 20:08 111fast