Skip to content
A script to generate a formatted country list in the format you want with their country codes. You can adapt it easily to generate the list you need in the language you want.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Country List

During a client project using Paypal DirectPayment API, I had to make a <select> with all the countries with their country code as the value. For example:

<option value="US">United States</option>
<option value="CA">Canada</option>

Paypal already gives this list

Problem is that it's only in English and all in caps. What I needed is a French version and an English version, not in caps. just happens to have what I needed. This script is what I coded to generate what I needed.

Hope it's useful to someone else.

You can’t perform that action at this time.