Converts multiple amounts in a single method call.
This method allows you to complete a large batch of currency conversions all at once without having to use the currencyConversion method for each conversion.
Currently this method supports bulk conversions from a single currency to another single currency and not several currencies simultaneously. (ie: if you want to convert fifty amounts from USD [US dollars] to CAD [Canadian dollars] and twenty amounts from USD to EUR [Euros] you would need to run two separate bulkCurrencyConversion method calls.)
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 currencyConversion, getSupportedCurrencies
CurrencyConversion bulkCurrencyConversion ( ueSecurityToken Token, integer FromCurrency, integer ToCurrency, double Amounts )
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 | Amounts | Array of Amounts being converted. |
CurrencyConversion | Returns conversion rates and amounts of currency converted. |
For directions on how to set up the WSDL link, create “$token” and “$client”, go to PHP Soap How-to.
<?php try { $ToCurrency='978'; $FromCurrency='840'; $Amounts=array( 50.10, 11.23, 34.21, 12.23 ); $res=$client->bulkCurrencyConversion($mctoken, $FromCurrency, $ToCurrency, $Amounts); print_r($res); $this->assertEquals(count($res), count($Amounts)); $this->assertEquals($res[0]->FromCurrency, $FromCurrency); $this->assertEquals($res[0]->Currency, $ToCurrency); $this->assertEquals($res[0]->FromAmount, $Amounts[0]); $this->assertTrue($res[0]->Rate > 0); $this->assertTrue($res[0]->Amount > 0); } catch (SoapFault $e) { die('Currency conversion failed : '.$e->getMessage()); } ?>