Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-06
7
Medium Priority
?
3,516 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 29

Assisted Solution

by:coreybryant
coreybryant earned 600 total points
ID: 24327589
Well it could depend on what country you are in but Country Codes might help.
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 1000 total points
ID: 24327911
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
ID: 24330737
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 0 total points
ID: 24330745
0
 
LVL 111

Expert Comment

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

Author Comment

by:NerdsOfTech
ID: 24331348
I went ahead and downloaded the entire dataset: 4260 rows. :)
0
 
LVL 111

Expert Comment

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

Best, ~Ray
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

618 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