Integrating Fedex API Into Your Website

Hoping you have gone through my previous and first article of this series, “Integrating FedEx Web Services Into Your Website“. In the article, I had explained the basic steps to start with Fedex API integration.

As explained in the basic steps, one needs to obtain the following before starting off and testing the codes of the APIs:

i. Test Account Number

ii. Test Meter Number

iii. Developer Test Key

iv. Password

Once you have obtained the following, you are ready to proceed with the article below for implementing the Fedex API real time.

Also Read: Key Ecommerce Trends In 2015 Every Marketer Should Know

Rating Web Service Integration

Before a shipping is done, the first thing a user needs to know is the money/rate he has to pay for selecting the particular shipping. For this we will be using the Rating Fedex API.

In the ‘Documentation and Downloads’ section of the ‘Fedex Web Services’ menu inDeveloper Resource Center, you will find two APIs under ‘Standard Services’ => ‘Rate Services’, namely, ‘Rate’ and ‘Rate Available Services’. You need to download them (download the PHP version of the API, since I will discuss in PHP) and also can refer to the Rating documentation by checking out the checkbox for ‘Include documentation(PDF)’.

As per the documentation, both the APIs are for rating functionality, but with a little difference.

Quoting the descriptions from the document:

RATE: “RateRequest wsdl provides a rate response on a single service.

Note: A rate request does not return the route or service availability. All rate quotes are estimates only and may differ from the actual invoiced amount.”

RATE AVAILABLE SERVICES: A Rate Available Services request will provide a list of available services from one request. Rates are returned for each service on the list.

[Note: A Rate Available Services request does not return route information, but does check the service availability and returns only those services that are actually available.]

Thus, Rate service returns the rate for only a particular available service whereas, the Rate Available service returns rates for all the available services in a location.

Today, I will discuss the Rate Available Services in PHP (download the PHP version of the API), which will give me the rates for all services available at a location.

Once you have downloaded and unzipped the RateAvailableService API, inside that you’ll find a PHP folder, where you will find 3 folders – library, wsdl and RateWebServiceClient.

wsdl: DO NOT make changes to the wsdl folder file during testing,.

library: contains a file named fedex-common.php5

RateWebServiceClient: contains RateAvailableServices => RateAvailableServicesWebServiceClient.php5

[Note: Since I am not using PHP5, I have modified all the file extensions in PHP5 to PHP.]

Thus I have 3 main files now after renaming:

RateAvailableServicesWebServiceClient.php, fedex-common.php and RateService_v16.wsdl

(Remember to change file names from PHP5 to PHP, in the code too, wherever required)

The documentation of Fedex API contains all the necessary details regarding each file and the nodes and parameters used in the API code. However, I will describe a few necessary parameters of each file briefly, for easier understanding.


This file contains all the common parameters and functions that will be required by the APIs at a point of time.

Integrating Fedex API

Once you open the file, you will find a function getProperty().

In the function, replace the ‘key’, ‘password’, ‘shipaccount’, ‘billaccount’, and ‘meter’ with the credentials that you had obtained while registration, as below:



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s