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.
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.
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.
来源:https://stackoverflow.com/questions/11297121/how-to-tell-credit-cards-country-of-origin-by-its-number