10 Jan 2008

If you're implementing PayPal Website Payments Pro Direct Payment in Flex, you're most likely going to need a ComboBox of country names and their ISO codes as expected by the PayPal API.

There's some freely available code for HTML but I couldn't find anything for Flex. It only took three find and replaces, however, to transform the HTML code into a lovely little Flex component. Here it is in hopes that it will save someone else the trouble in the future.

Screenshot of Paypal Country ComboBox

To use the PayPalCountryComboBox component, download and unzip it into the source folder of your Flex project. Then, just include it in your MXML as shown below.

<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:paypal="com.aralbalkan.paypal.*"
>
<paypal:PayPalCountryComboBox />
</mx:Application>

Download the PayPalCountryComboBox (.zip, 8kb).

Add Your Comment

Spam Protection by WP-SpamFree

PayPal country list component for Flex

  1. cool stuff Aral, did something similar a while back — http://www.peterelst.com/blog/2006/12/24/flex-country-combobox-component/

    Peter
  2. Hey Peter,

    Thanks for the link, man! :)

    I was googling for a PayPal country combobox so I didn’t run across yours. Oh well. I’m sure the country listing is pretty identical. Wish I’d seen your more feature-laden version earlier!

    Still, this is a simple alternative that should play nice with the PayPal back-end as it’s based on the recommended code of one of their staff.

    Aral
  3. I threw this Array together, making it a bit more Flexible.

    http://www.tink.ws/blog/files/as3/PayPalCountries.as

    usage for a ComboBox:

    Tink
  4. Thanks, Tink! :)

    If part of the comment didn’t come through, just email it to me and I’ll put it up. If it was code, enclosing it in <pre lang=”xml” > should work in the future. Also lang=”actionscript”.

    Aral
  5. ‘Oh no! You’re looking for something which just isn’t here!’ link to the zip seems to be busted… p;)

    paddy
  6. Hi Aral,
    the link for downloading your PayPalCountryComboBox seems to be broken. It’s the tool I’ve been looking for! Any chance to get hold of it?

    Best, Bjoern

    Björn