FreakSoft
FreakSoft

Reputation: 393

Fedex how to set preferred currency in PHP

Fedex seems to have very intuitive documentation and no code samples (besides the downloaded modules). I want to change the currency for the rates from fedex. In documentation/XML file I have found something like preferredCurrency. Similar to other attributes I'm trying to set it like this:

if($var == 'preferredcurrency') Return 'HUF';

but this is totally ignored (I tried also PreferredCurrency) and the returned rate is always $USD. Anyone is familiar with FEDEX API and can help?

UPDATE:

It's basically about requesting and receiving response. I have some function where I set parameters like:

function getProperty($var){
if($var == 'shipper') Return array(
        'Contact' => array(
            'PersonName' => 'Sender Name',
            'CompanyName' => 'Sender Company Name',
            'PhoneNumber' => '1234567890'
        ),
        'Address' => array(
            'StreetLines' => array('Address Line 1'),
            'City' => 'SomeCity',
            'StateOrProvinceCode' => 'SomeState',
            'PostalCode' => '3434343',
            'CountryCode' => 'US',
            'Residential' => 1
        )
    );
}

and then in another file a request to fedex is made, like :

$request['RequestedShipment']['Shipper'] = array(
    'Address'=>getProperty('address1')
); 

All of this values are defined in an XML file, I'm trying to get rate including CurrencyExchangeRate like this:

$request['CurrencyExchangeRate'] = array(
    'FromCurrency' => array('USD'),
    'IntoCurrency' => array('HUF'),
    'Rate' => array(1.0)
);

But this request is ignored and I don't know why.

Upvotes: 1

Views: 963

Answers (1)

Aridaman Bal
Aridaman Bal

Reputation: 111

Maybe you just have a misssing Element. The Docs are here: Shipment Docs.

$request['RequestedShipment']['PreferredCurrency'] = 'HUF' and $request['RequestedShipment']['RateRequestTypes'] = 'PREFERRED'

Upvotes: 2

Related Questions