Skip to main content

Retrieve available currencies

Retrieve available currencies

Last updated: 04-Jun-2021
Rate this article:

Overview

Use the getAvailableCurrencies method via SOAP API 6.0 to get the list of available currencies. If the countryCode parameter is added, the paymentMethod parameter also becomes mandatory (you need to use both parameters or none).

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.
countryCode String Required The ISO country code (two-letter code). If the countryCode parameter is used, the paymentMethod parameter must be used as well and both parameters are mandatory.
paymentMethod String Required The payment method for which you are retrieving the list of available currencies.

Request Example

<?php

$apiVersion = '6.0';
$host = "http://api.avangate.local:8081/soap/".$apiVersion."/";

$client = new SoapClient($host."?wsdl", array('location' => $host, 'cache_wsdl' => WSDL_CACHE_NONE));
$client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');

$merchantCode = "124231873235";
$key = "%&7+J[Q7T!B!1(z1e7&a";

$date = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);

try {
    echo "login \r\n";
    $sessionID = $client->login($merchantCode, $date, $hash);
} catch (SoapFault $e) {
    echo  $e->getMessage();
}

print_r("session: ". $sessionID);

$countryCode = 'ro';
$paymentMethod = 'CC';

try {
//    $response = $client->getAvailableCurrencies($sessionID);
    $response = $client->getAvailableCurrencies($sessionID, $countryCode, $paymentMethod);
}

catch (SoapFault $e) {
    echo "VendorSettingsController.php: " . $e->getMessage();
    exit;
}
var_dump($response);

Response

Parameter Name Type Description
currencies Array An array of currency objects.

Response Example

[
  {
      "Code":"USD",
      "ISO3DigitCode":"840",
      "Label":"United States Dollar",
      "Symbol":"$",
      "SymbolPosition":"left",
      "DecimalSeparator":".",
      "UnitSeparator":",",
      "Decimals":"2"
   }
] 
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