Fedex Rate

 

Here is a very simple rate example for Fedex. Any shipper’s module of Supreme Tracking needs authorization information. Obtain account on Fedex site. Create rate request object and then set authentication ticket.

 

FedExRateRequest request = new FedExRateRequest();

FedExAuthTicket ticket = new FedExAuthTicket();

 

You have to set some required information to ticket. Remember to assign this ticket to request object. 

 

ticket.CarrierCode = FedExCarrierCode.FedExExpress; 

ticket.CustomerTransactionId = "your transaction id";

ticket.MeterNumber = "your meter number";

ticket.AccountNumber = "your account number";

request.AuthTicket = ticket; 

 

Here we have the most important part of rating procedure. Choose service code for your needs and packacking type. Service and packaging options determine rate cost. Sender and destination address information also has to be defined.

 

request.Service = FedExServiceCode.FedExExpressSaver; 

request.DestinationAddress = new FedExAddress();

request.DestinationAddress.CountryCode = "US";

request.DestinationAddress.PostalCode = "34107";

 

request.OriginAddress = new FedExAddress();

request.OriginAddress.CountryCode = "US";

request.OriginAddress.PostalCode = "34107";

request.Weight = 1; 

request.Packaging = FedExPackagingCode.FedExBox; 

 

Now, just make an instance of Fedex rate and check for response.

 

FedExRateProvider rate = new FedExRateProvider();

FedExRateResponse respone = rate.Check(request, false);