Jump to content

Recommended Posts

Hi,

 

I am trying to integrate Fedex Shipping direct API to my website.

 

 

The test page is uploaded to the following link: http://www.kaplanmd.com/fedextest/fedec.php

 

 

 

Here    1. FedEx Ground

 

2. FedEx 2 Day Express and

 

3. FedEx Overnight Express

 

 

 

Are working fine till yesterday. But today it is only returning the FedEx Ground rate. For the other two it is not returning even though I am not getting any error. Also

 

Can anyone please let me know what went wrong? For your reference here I am copying the code beneath:

 

 

 

Apart from this I also have got some confusion for the

 

International Priority Express and

International Economy

 

 

For International priority and Economy I am sending 70 & 80 respectively for code 1274 i.e. the service type and the Carrier Code is FDXE.

 

For priority express it is returning the error as ERROR: FedEx Return Error 1209: Selected Service requires Dim length, width, and height. u can see in the test side. 

 

Even if I enter these values still it is showing more errors. Could someone please help me in this?

 

 

 

For the Economy I am getting Invalid packaging/service combination error. Could you please let me know what the correct Package/Service combination is?

 

And if the customer specifies the shipment country other than US what are the tags that must be passed?

 

 

 

 

 

Below is the code both user interface php code and the class to talk with FedEx API

 

 

 

 

 

 

 

 

 

Code for User Interface

 

 

 

 

 

$servertype='test';

 

 

 

include('fedexdc.php');

 

 

 

if ($_POST['uSubmit']!=""){

 

            // create new fedex object

 

            $fed = new FedExDC('###########','########');

 

            $sType = $_POST['sType'];

 

            switch($sType)

 

            {

 

                        case "FGround" : $carrCode = "FDXG";

 

                                                                        $servType = "92";

 

                                                                        break;

 

                        case "F2day" :  $carrCode = "FDXE";

 

                                                                        $servType = "03";

 

                                                                        //echo "carr code: " . $carrCode . "  Service : ".$servType;

 

                                                                        break;

 

                        case "Fovernite" : $carrCode = "FDXE";

 

                                                                                    $servType = "05";

 

                                                                                    break;

 

                        case "Fintprio" : $carrCode = "FDXE";

 

                                                                                    $servType = "70";

 

                                                                                    break;

 

                        case "Finteco" : $carrCode = "FDXE";

 

                                                                                    $servType = "86";

 

                                                                                    break;

 

            }

 

           

 

           

 

            $ship_data = array(

 

                        75=>  'LBS'            // Weight Units Valid weight types: • LBS • KGS  Must be LBS on a U.S. rate quote.

 

                       

 

                        ,16=>  'Ma'        //Recipient State.Required only if Recipient Country Code is US or CA.Represents the state or province                            to which the shipment is destined.

 

                       

 

                        ,13=>  '44 Main street' // Recipient Address Line 1. Primary address line to which the shipment is destined.

 

                       

 

                        ,5=>    '435 N Roxbury Drive' //Sender Address Line 1 . Primary address line from which the shipment is originating.

 

                       

 

                        ,1273=> '01'  //Packaging Type. FedEx Express shipping packaging types are: 01 – Other packaging 02 – FedEx Pak 03 – FedEx                        Box 04 – FedEx Tube 06 – FedEx Envelope 15* – FedEx 10kg Box (international only) 25* – FedEx 25kg Box                      (international only) FedEx Ground shipping packaging types are: 01 – Customer packaging    Defaults to 01                        if not specified.

 

                       

 

                        ,1274=> $servType // Service Type. List available in Fedex documentation PDF file. Page  No: 231

 

                       

 

                                               

 

                        ,18=>  '6173335555' //Recipient Phone Number. Phone number for the contact person to whom the shipment is destined.The                            maximum length is 10 for US and CA, 15 for all other countries. Do not include embedded special                            characters.

 

                       

 

                        ,15=>  'Boston' // Recipient City. Name of the city to which the shipment is destined.A minimum of 3 alpha characters must                            be passed.

 

                       

 

                        ,23=>  '1' //Pay Type.Only Bill Sender and Bill Third Party are allowed. Valid payment types are: 1 = Bill sender                    (Prepaid) 2 = Bill recipient (for FedEx Express); Collect (for FedEx Ground) 3 = Bill third party 5 = Bill                      recipient for FedEx Ground

 

                       

 

                        ,9=>    '90210' // Sender Postal Code. Required only if Sender Country Code is US or CA. Postal code may also be required                          for other postal-aware countries. Represents the postal code from which the shipment will be                          originating.Valid characters: A-Z; 0-9; a-z

 

                       

 

                        ,183=>  '3103955006' // Sender Phone Number. The phone number of the person initiating the shipment.The maximum length is                              10 for US and CA, 16 for all other countries. Do not include. embedded special characters.

 

                       

 

                        ,8=>    'CA' //Sender State.Required only if Sender Country Code is US or CA.

 

                       

 

                        ,117=>  'US' //Sender Country Code. Represents the country from which the shipment will be originating.

 

                       

 

                        ,17=>  '02116'//Recipient Postal Code.Required only if Recipient Country Code is US or CA.Postal code may also be required                        for other postal-aware countries.Represents the postal code to which the shipment is destined.Valid                        characters: A-Z; 0-9; a-z

 

                       

 

                        ,50=>  'US' //  Recipient Country Code.Represents the country code to which the shipment is destined.

 

                       

 

                        ,4=>    'Kaplan MD'//Sender Company.Required if the sender contact name is not passed in the transaction.If included in the                            transaction, a minimum of 3 alpha characters must be passed.

 

                       

 

                        ,7=>    'Beverly Hills'//Sender City. City name from which the shipment is originating. Minimum of 3 alpha characters must                                  be passed for shipping.

 

                       

 

                        ,1369=> '1' //Label Printer Type. Required to indicate label formatting.Valid values: 1 = Laser printer    2 = Eltron Orion                    (EPL2)      3 = Eltron Eclipse (EPL2)        4 = Zebra ZPL and ZPL II    5 = Unimark

 

                       

 

                        ,12=>  'Jay Powers' //Recipient Contact Name. Required if Recipient Company Name was not passed in the Request transaction                              and COD service is selected. If passed in the transaction, a minimum of 3 alpha characters must be                              passed.

 

                       

 

                        ,1333=> '1'  //Drop Off Type. Valid values: 1 if regular pickup  2 if request courier 3 if drop box  4 if drop at BSC  5 if                      drop at station.  Only 1 (regular pickup), 2 (request courier), or 5 (drop at station) are allowed with                      international freight shipping.

 

                       

 

                        ,1401=> '7.0' //Total Package Weight/Shipment total weight. This is used for actual piece weight only, not total shipment                      weight.

 

                       

 

                        ,116 => 1//Package Total(Total Number of Pieces)

 

                       

 

                        ,68 =>  'USD'//Customs/Declared Value Currency Type

 

                       

 

                        ,1368 => 2 //Label Type. 2 = 2D Common

 

                        //,1369 => 1

 

                        ,1370 => 5 // Label Media Type

 

                        //,955 =>'test'

 

                        ,3025 => $carrCode // Carrier Code.          Valid values:FDXE – FedEx Express    FDXG – FedEx Ground

 

                       

 

                        ,1119 =>'N' //Future Day Shipment. Y if shipment is future day.

 

                        //,1415=> '100.00'

 

                        //,57 =>'20'

 

                        // ,58 =>'20'

 

        // ,59 =>'20'

 

 

 

                        ,99 =>"" // Transaction end

 

            );

 

           

 

            // Ship example

 

            $ship_Ret = $fed->ship_express($ship_data);

 

           

 

            if ($error = $fed->getError()) {

 

                        echo "ERROR :". $error;

 

            } else {

 

                        // Save the label to disk

 

                        $fed->label('mylabel.png');

 

           

 

            }

 

}

 

 

 

/* tracking example

 

 

 

$track_Ret = $fed->track(

 

array(

 

    29 => 790344664540,

 

));

 

 

 

*/

 

 

 

 

 

 

 

echo $fed->debug_str. "\n<BR>";

 

//echo "Surcharge ".$ship_Ret[1417]. "\n<BR>"; 

 

echo "Price ".$ship_Ret[1419];

 

 

 

 

 

 

 

?>

 

<table>

 

<form method="post" action="">

 

<tr>

 

<td>US Customers :</td>

 

<td>  </td>

 

<td><input type="radio" name="sType" value="FGround">  Fedex Ground</td>

 

</tr>

 

<tr>

 

<td>  </td>

 

<td>  </td>

 

<td><input type="radio" name="sType" value="F2day">  Fedex 2 Day Express</td>

 

</tr>

 

<tr>

 

<td>  </td>

 

<td>  </td>

 

<td><input type="radio" name="sType" value="Fovernite">  Fedex Overnight Express</td>

 

</tr>

 

<tr>

 

<td>International Customers :</td>

 

<td>  </td>

 

<td><input type="radio" name="sType" value="Fintprio">  International Priority Express</td>

 

</tr>

 

<tr>

 

<td>  </td>

 

<td>  </td>

 

<td><input type="radio" name="sType" value="Finteco">  International Economy</td>

 

</tr>

 

 

 

<tr>

 

<td>

 

<input type="submit" name="uSubmit" value="Calculate">

 

</td>

 

</tr>

 

</form>

 

</table>

 

Many Thanks in Advance

 

Link to comment
https://forums.phpfreaks.com/topic/56357-please-help-fedex-integration/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.