23

I'm trying to develop an application, which would give access to different services for people from different regions of the world.

Let's say, someone enters card number 1111-1111-1111-1111 . How do I use it to tell the country of origin?

I know that this is possible, because paypal and apple do it.

Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
  • There's no country information encoded in the number itself; you need access to the customer's account information to get that. See http://adywicaksono.wordpress.com/2008/02/17/how-to-validate-credit-card-number/ – Robert Harvey Jul 02 '12 at 16:00
  • 1
    @RobertHarvey That's not entirely true, see my post – ZnArK Jul 02 '12 at 16:03
  • 3
    http://www.binbase.com/ , http://dev.maxmind.com/minfraud/ – Emilio Gort May 27 '14 at 19:02

3 Answers3

36

Use BinList. It simply tells you the country of origin by checking the first 6 digits of the card number. It has a neat Json based API as well.

Pecheneg
  • 768
  • 3
  • 11
  • 27
5

At first, I questioned whether this information could be gleened from the credit card number alone.

Then I found it here:

http://en.wikipedia.org/wiki/List_of_Bank_Identification_Numbers

Edit - Don't forget about PCI Compliance if you are taking credit card numbers for payment.

Edit - Apparently the previous wikipedia page has been deleted. This appears to have similar information.

ZnArK
  • 1,533
  • 1
  • 12
  • 23
  • Well, sure. But couldn't I get a Visa card in the United States and use it while living abroad, or vice versa? Sure, you can get broad provider information, but I don't see how that would be useful at all for marketing purposes. – Robert Harvey Jul 02 '12 at 16:05
  • @RobertHarvey That is true. (I've done it) I'm interested in what the OP is trying to do with the country information. I would imagine that IP based geolocation would suit well for detecting what country a transaction is coming from. – ZnArK Jul 02 '12 at 16:11
  • the link isnt available – Emilio Gort May 27 '14 at 19:03
4

checkout https://binlist.io/ opensource and it looks like they have a maintained csv file on their github page: https://github.com/iannuttall/binlist-data

Sjaak Wish
  • 455
  • 5
  • 8