This is an old revision of the document!
Find currency conversion rate for a transaction amount.
This method allows you to determine the rate of conversion for different currencies in multi-currency transactions. A merchant account must have support for specific types of currency before it will be able to run multi-currency transactions.
To determine if a currency is supported by a merchant account, use either the getSupportedCurrencies or the getAccountDetails method.
Each currency type is assigned a three digit numeric code (ie: USD=840, Japanese yen=392). You must enter the three digit code for both the original currency and the converted currency in a conversion. The Currency Code list provides all of the three digit codes and their corresponding currencies for international currency conversion.
If you would like to add support for multi-currency transactions to a merchant account please contact the merchant's service provider or customer service.
See also bulkCurrencyConversion, getSupportedCurrencies, getAccountDetails
CurrencyConversion currencyConversion ( ueSecurityToken Token, integer FromCurrency, integer ToCurrency, double Amount )
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and validate transaction. |
integer | FromCurrency | Currency code funds will be converted from. |
integer | ToCurrency | Currency code funds will be converted to. |
double | Amount | Amount of currency to be converted. |
CurrencyConversion | Returns the rate of conversion and the amount of the converted currency. |
<?php // for directions on how to set up the // WSDL link and create "$mctoken" and "$client," // see: http://usaepay.com/developer/howto/php. try { $ToCurrency='978'; $FromCurrency='840'; $Amount=50; $res=$client->currencyConversion($mctoken, $FromCurrency, $ToCurrency, $Amount); print_r($res); $this->assertEquals($res->FromCurrency, $FromCurrency); $this->assertEquals($res->Currency, $ToCurrency); $this->assertTrue($res->Rate > 0); $this->assertTrue($res->Amount > 0); } catch (SoapFault $e) { echo $client->__getLastRequest(); echo $client->__getLastResponse(); die('Currency conversion failed : '.$e->getMessage()); } ?>