1. Navigation
  2. Content

» Validating UK Credit & Debit Cards With LUHN to Type | Chris Mckee Designs, by Chris McKee, who'd of guessed | ChrisMcKee.co.uk


6 Responses to “ Validating UK Credit & Debit Cards With LUHN to Type ”

  1. hey Chris,

    Just thought I'd say firstly, very nicely done - this will indeed save headaches.

    I'm sitting here with a visa debit card in front of me with the prefix 4539 so it may be worth adding that (I shall do so to the code that I've downloaded).

    It's incredible that there are so few decent sources of regexes for this sort of thing - one would think it should be a relatively straight forward process!

    I also found: http://en.wikipedia.org/wiki/Credit_card_numbers though didn't find that helped much at all (it claims anything that isn't visa electron is visa credit, which isn't true, though their regex's/prefixes again don't cover my local scenario (4539 prefix + debit card).

    Cheers,
    Terry

  2. @Terry: I'll be updating the regex soon enough as I have a full UK BIN table (including the card you've got).

  3. It appears that you've put a good amount of effort into your article and I want a lot more of these on the web these days. I truly got a kick out of your post. I do not have a bunch to to say in response, I only wanted to register to say marvellous work.

  4. Killer blog! Nice one, I'll be back for more.

  5. Hey Chris

    I have tested your code with my website!! It is just saying the the number is valid or not. I need that my website should accept only UK Credit card or debit card.

    Can you help me in this regard. I feel there may some more checks require in above code.

    Please help me, it is spoiling my life!!!

  6. With regards credit cards, the checks are simple at best (checking for the start number).
    You usually limit the regions your willing to accept by limiting the "billing address" country, which is then verified when you pass the address to the card handler for address validation.