Skip to main content

Retrieve available countries

Retrieve available countries

Last updated: 20-Apr-2021
Rate this article:


Use the getAvailableCountries method to get the list of available countries for the current merchant. If the language parameter is provided, all the returned countries will be translated into that language.

Request Parameters

Parameter Name Type Required/Optional Description
sessionId String Required Session identifier, the output of the Login method. Include sessionId into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionId expires in 10 minutes.
language String Optional The ISO language code (two-letter code). If the language parameter is empty, the default language will be English.

Request Example

class Configuration
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = '';
    public const ACTION = 'getAvailableCountries';
    public const ADDITIONAL_OPTIONS = null;
    public const PAYLOAD = "nl";

class Client
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ) {
        if (is_array($payload)) {
            $payload = json_encode($payload);
        $soapClient = $this->getClient($url);
        $sessionId = $this->getSession($soapClient);
        $args = array_filter([$sessionId, $payload]);

        return $soapClient->$action(...$args);

    public function getClient(string $url): SoapClient
        return new SoapClient(
                'location' => $url,
                'cache_wsdl' => WSDL_CACHE_NONE,

    public function getSession(SoapClient $client)
        $date = gmdate('Y-m-d H:i:s');
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $string = strlen($merchantCode).$merchantCode.strlen($date).$date;
        $hash = hash_hmac('md5', $string, $key);
        $client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');

        return $client->login($merchantCode, $date, $hash);

try {
    $client = new Client();
} catch (Exception $ex) {


Parameter Name Type Description
countries Array An array of country objects, mode of country code, and translated country name.

Response Example

    “Code”: “AE”,
    “Label”: “Verenigde Arabische Emiraten”
    “Code”: “AF”,
    “Label”: “Afghanistan”

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo