Solved

Paypal, country codes/names, state/provence codes/names

Posted on 2009-05-06
7
2,421 Views
Last Modified: 2013-12-12
Where can I find a list of country codes and names that paypal allows payments to be made from?
0
Comment
Question by:NerdsOfTech
  • 3
  • 3
7 Comments
 
LVL 29

Assisted Solution

by:coreybryant
coreybryant earned 150 total points
Comment Utility
Well it could depend on what country you are in but Country Codes might help.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
Comment Utility
Check this page.
https://www.paypal.com/worldwide/

You may be able to modify the class below to suit your needs.

Best regards, ~Ray
<?php // RAY_country_codes.php

error_reporting(E_ALL);
 

class CountryNames

{
 

// DECLARE THE VARIABLES

private $can; // COUNTRY ABBREVIATIONS POINT TO NAMES

private $cna; // COUNTRY NAMES POINT TO ABBREVIATIONS
 

// DECLARE THE CONSTRUCTOR TO LOAD THE ARRAY

function __construct()

{

	if (!isset($can))

	{

		$can = array();

		$this->can["af"] = "Afghanistan";

		$this->can["ax"] = "&Aring;land Islands";

		$this->can["al"] = "Albania";

		$this->can["dz"] = "Algeria";

		$this->can["as"] = "American Samoa";

		$this->can["ad"] = "Andorra";

		$this->can["ao"] = "Angola";

		$this->can["al"] = "Anguilla";

		$this->can["ag"] = "Antigua and Barbuda";

		$this->can["ar"] = "Argentina";

		$this->can["am"] = "Armenia";

		$this->can["aw"] = "Aruba";

		$this->can["au"] = "Australia";

		$this->can["at"] = "Austria";

		$this->can["az"] = "Azerbaijan";

		$this->can["bs"] = "Bahamas";

		$this->can["bh"] = "Bahrain";

		$this->can["bd"] = "Bangladesh";

		$this->can["bb"] = "Barbados";

		$this->can["by"] = "Belarus";

		$this->can["be"] = "Belgium";

		$this->can["bz"] = "Belize";

		$this->can["bj"] = "Benin";

		$this->can["bm"] = "Bermuda";

		$this->can["bt"] = "Bhutan";

		$this->can["bo"] = "Bolivia";

		$this->can["ba"] = "Bosnia and Herzegovina";

		$this->can["bw"] = "Botswana";

		$this->can["bv"] = "Bouvet Island";

		$this->can["br"] = "Brazil";

		$this->can["io"] = "British Indian Ocean territory";

		$this->can["bn"] = "Brunei Darussalam";

		$this->can["bg"] = "Bulgaria";

		$this->can["bf"] = "Burkina Aso";

		$this->can["bi"] = "Burundi";

		$this->can["kh"] = "Cambodia";

		$this->can["cm"] = "Cameroon";

		$this->can["ca"] = "Canada";

		$this->can["bs"] = "Cape Verde";

		$this->can["cv"] = "Cayman Islands";

		$this->can["cf"] = "Central African Republic";

		$this->can["td"] = "Chad";

		$this->can["cl"] = "Chile";

		$this->can["cn"] = "China";

		$this->can["cx"] = "Christmas Island";

		$this->can["cc"] = "Cocos (Keeling) Islands";

		$this->can["co"] = "Colombia";

		$this->can["km"] = "Comoros";

		$this->can["cg"] = "Congo";

		$this->can["cd"] = "Congo, Democratic Republic";

		$this->can["ck"] = "Cook Islands";

		$this->can["cr"] = "Costa Rica";

		$this->can["ci"] = "C&ocirc;te d'Ivoire (Ivory Coast)";

		$this->can["hr"] = "Croatia (Hrvatska)";

		$this->can["cu"] = "Cuba";

		$this->can["cy"] = "Cyprus";

		$this->can["cz"] = "Czech Republic";

		$this->can["dk"] = "Denmark";

		$this->can["dj"] = "Djibouti";

		$this->can["dm"] = "Dominica";

		$this->can["do"] = "Dominican Republic";

		$this->can["ec"] = "Ecuador";

		$this->can["eg"] = "Egypt";

		$this->can["sv"] = "El Salvador";

		$this->can["gq"] = "Equatorial Guinea";

		$this->can["er"] = "Eritrea";

		$this->can["ee"] = "Estonia";

		$this->can["et"] = "Ethiopia";

		$this->can["fk"] = "Falkland Islands";

		$this->can["fo"] = "Faroe Islands";

		$this->can["fj"] = "Fiji";

		$this->can["fi"] = "Finland";

		$this->can["fr"] = "France";

		$this->can["pf"] = "French Polynesia";

		$this->can["tf"] = "French Southern Territories";

		$this->can["ga"] = "Gabon";

		$this->can["gm"] = "Gambia";

		$this->can["ge"] = "Georgia";

		$this->can["de"] = "Germany";

		$this->can["gh"] = "Ghana";

		$this->can["gl"] = "Gibraltar";

		$this->can["gr"] = "Greece";

		$this->can["gl"] = "Greenland";

		$this->can["gd"] = "Grenada";

		$this->can["gp"] = "Guadeloupe";

		$this->can["gu"] = "Guam";

		$this->can["gt"] = "Guatemala";

		$this->can["gn"] = "Guinea";

		$this->can["gw"] = "Guinea-Bissau";

		$this->can["gy"] = "Guyana";

		$this->can["ht"] = "Haiti";

		$this->can["hm"] = "Heard and McDonald Islands";

		$this->can["va"] = "Honduras";

		$this->can["hk"] = "Hong Kong";

		$this->can["hu"] = "Hungary";

		$this->can["is"] = "Iceland";

		$this->can["in"] = "India";

		$this->can["id"] = "Indonesia";

		$this->can["ir"] = "Iran";

		$this->can["iq"] = "Iraq";

		$this->can["ie"] = "Ireland";

		$this->can["il"] = "Israel";

		$this->can["it"] = "Italy";

		$this->can["jm"] = "Jamaica";

		$this->can["jp"] = "Japan";

		$this->can["jo"] = "Jordan";

		$this->can["kz"] = "Kazakhstan";

		$this->can["ke"] = "Kenya";

		$this->can["ki"] = "Kiribati";

		$this->can["kp"] = "Korea (north)";

		$this->can["kr"] = "Korea (south)";

		$this->can["kw"] = "Kuwait";

		$this->can["kg"] = "Kyrgyzstan";

		$this->can["la"] = "Lao People's Democratic Republic";

		$this->can["lv"] = "Latvia";

		$this->can["lb"] = "Lebanon";

		$this->can["ls"] = "Lesotho";

		$this->can["lr"] = "Liberia";

		$this->can["ly"] = "Libyan Arab Jamahiriya";

		$this->can["li"] = "Liechtenstein";

		$this->can["lt"] = "Lithuania";

		$this->can["lu"] = "Luxembourg";

		$this->can["mo"] = ">Macao";

		$this->can["mk"] = "Macedonia (FYROM)";

		$this->can["mg"] = "Madagascar";

		$this->can["mw"] = "Malawi";

		$this->can["my"] = "Malaysia";

		$this->can["mv"] = "Maldives";

		$this->can["ml"] = "Mali";

		$this->can["mt"] = "Malta";

		$this->can["mh"] = "Marshall Islands";

		$this->can["mq"] = "Martinique";

		$this->can["mr"] = "Mauritania";

		$this->can["mu"] = "Mauritius";

		$this->can["yt"] = "Mayotte";

		$this->can["mx"] = "Mexico";

		$this->can["fm"] = "Micronesia";

		$this->can["md"] = "Moldova";

		$this->can["mc"] = "Monaco";

		$this->can["mn"] = "Mongolia";

		$this->can["ms"] = "Montserrat";

		$this->can["ma"] = "Morocco";

		$this->can["mz"] = "Mozambique";

		$this->can["mm"] = "Myanmar";

		$this->can["na"] = "Namibia";

		$this->can["nr"] = "Nauru";

		$this->can["np"] = "Nepal";

		$this->can["nl"] = "Netherlands";

		$this->can["an"] = "Netherlands Antilles";

		$this->can["nc"] = "New Caledonia";

		$this->can["nz"] = "New Zealand";

		$this->can["ni"] = "Nicaragua";

		$this->can["ne"] = "Niger";

		$this->can["ng"] = "Nigeria";

		$this->can["nu"] = "Niue";

		$this->can["nf"] = "Norfolk Island";

		$this->can["mp"] = "Northern Mariana Islands";

		$this->can["no"] = "Norway";

		$this->can["om"] = "Oman";

		$this->can["pk"] = "Pakistan";

		$this->can["pw"] = "Palau";

		$this->can["ps"] = "Palestinian Territories";

		$this->can["pa"] = "Panama";

		$this->can["pg"] = "Papua New Guinea";

		$this->can["py"] = "Paraguay";

		$this->can["pe"] = "Peru";

		$this->can["ph"] = "Philippines";

		$this->can["pn"] = "Pitcairn";

		$this->can["pl"] = "Poland";

		$this->can["pt"] = "Portugal";

		$this->can["pr"] = "Puerto Rico";

		$this->can["qa"] = "Qatar";

		$this->can["re"] = "R&eacute;union";

		$this->can["ro"] = "Romania";

		$this->can["ru"] = "Russian Federation";

		$this->can["rw"] = "Rwanda";

		$this->can["sh"] = "Saint Helena";

		$this->can["kn"] = "Saint Kitts and Nevis";

		$this->can["lc"] = "Saint Lucia";

		$this->can["pm"] = "Saint Pierre and Miquelon";

		$this->can["vc"] = "Saint Vincent and the Grenadines";

		$this->can["ws"] = "Samoa";

		$this->can["sm"] = "San Marino";

		$this->can["st"] = "Sao Tome and Principe";

		$this->can["sa"] = "Saudi Arabia";

		$this->can["sn"] = "Senegal";

		$this->can["cs"] = "Serbia and Montenegro";

		$this->can["sc"] = "Seychelles";

		$this->can["sl"] = "Sierra Leone";

		$this->can["sg"] = "Singapore";

		$this->can["sk"] = "Slovakia";

		$this->can["sl"] = "Slovenia";

		$this->can["sb"] = "Solomon Islands";

		$this->can["so"] = "Somalia";

		$this->can["za"] = "South Africa";

		$this->can["gs"] = "South Georgia and the South Sandwich Islands";

		$this->can["es"] = "Spain";

		$this->can["lk"] = "Sri Lanka";

		$this->can["sd"] = "Sudan";

		$this->can["sr"] = "Suriname";

		$this->can["sj"] = "Svalbard and Jan Mayen Islands";

		$this->can["sz"] = "Swaziland";

		$this->can["se"] = "Sweden";

		$this->can["ch"] = "Switzerland";

		$this->can["sy"] = "Syria";

		$this->can["tw"] = "Taiwan";

		$this->can["tj"] = "Tajikistan";

		$this->can["tz"] = "Tanzania";

		$this->can["th"] = "Thailand";

		$this->can["tg"] = "Togo";

		$this->can["tk"] = "Tokelau";

		$this->can["to"] = "Tonga";

		$this->can["tt"] = "Trinidad and Tobago";

		$this->can["tn"] = "Tunisia";

		$this->can["tr"] = "Turkey";

		$this->can["tm"] = "Turkmenistan";

		$this->can["tc"] = "Turks and Caicos Islands";

		$this->can["tv"] = "Tuvalu";

		$this->can["ug"] = "Uganda";

		$this->can["ua"] = "Ukraine";

		$this->can["ae"] = "United Arab Emirates";

		$this->can["gb"] = "United Kingdom";

		$this->can["us"] = "United States of America";

		$this->can["uy"] = "Uruguay";

		$this->can["uz"] = "Uzbekistan";

		$this->can["vu"] = "Vanuatu";

		$this->can["ve"] = "Venezuela";

		$this->can["vn"] = "Vietnam";

		$this->can["vg"] = "Virgin Islands (British)";

		$this->can["vi"] = "Virgin Islands (US)";

		$this->can["wf"] = "Wallis and Futuna Islands";

		$this->can["eh"] = "Western Sahara";

		$this->can["ye"] = "Yemen";

		$this->can["zm"] = "Zambia";

		$this->can["zw"] = "Zimbabwe";

	}
 

	if (!isset($this->cna))

	{

		$this->cna = array_flip($this->can);

	}
 

}
 

// FUNCTION TO GET NAME FROM ABBREVIATION

public function get_country_name($abbr)

{

	$abbr = strtolower($abbr);

	if (!isset($this->can["$abbr"])) return FALSE;

	return $this->can["$abbr"];

}
 

// FUNCTION TO GET ABBREVIATION FROM NAME

public function get_country_abbr($name)

{

	if (!isset($this->cna["$name"])) return FALSE;

	return strtoupper($this->cna["$name"]);

}
 

// END OF CLASS

}
 

// TEST DATA

echo "<pre>\n";

$ca   = new CountryNames;

$abbr = $ca->get_country_abbr("United States of America");

var_dump($abbr);
 

$name = $ca->get_country_name("GS");

var_dump($name);
 

$xerr = $ca->get_country_name("XX");

var_dump($xerr);
 

?>

Open in new window

0
 
LVL 19

Author Comment

by:NerdsOfTech
Comment Utility
I found a source that is exactly what I need. I would like to share it with you and distribute points to you for your efforts.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 0 total points
Comment Utility
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Amazing!  I never knew there were so many cities in Afghanistan.  thanks, ~Ray
0
 
LVL 19

Author Comment

by:NerdsOfTech
Comment Utility
I went ahead and downloaded the entire dataset: 4260 rows. :)
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
Might also be a useful reference:
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

Best, ~Ray
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now