Retrieve available currencies
Use the getAvailableCurrencies method via JSON-RPC 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
sessionId
Required (string)
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
Required (string)
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
Required (string)
The payment method for which you are retrieving the list of available currencies.
Request sample
<?php
include('Config.php');
// Grab Config Values
$config = new ConfigScripts();
$apiVersion = '6.0';
$i = 1;
$host = 'http://api.avangate.local:8081/rpc/' . $apiVersion . "/";
// Login to get the session id;
$sessionID = $config->rpcLogin($host);
$countryCode = 'ro';
$paymentMethod = 'CC';
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getAvailableCurrencies',
// 'params' => [$sessionID]
'params' => [$sessionID, $countryCode, $paymentMethod]
);
$response = $config->callRPC($jsonRpcRequest, $host, true);
print_r(json_encode($response));
?>Response parameters
currencies
Array
An array of currency objects.
Response sample
Last updated
Was this helpful?