簡體   English   中英

Fedex 是否提供折扣運費?

[英]Does Fedex Provide Discounted Shipment Rates?

有人幫我找到使用 FedEx api 的費率服務嗎? 我有 3 個文件用於查找費率服務。

我在這里從https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html下載了所有三個文件。 當我運行 RateWebServiceClient.php 然后它顯示一個錯誤:

交易返回錯誤。 嚴重性:錯誤來源:教授代碼:1000 消息:身份驗證失敗

API 密鑰、API 密碼、儀表編號、帳號等所有憑據均正確無誤

1.fedex-common.php5

2.RateWebServiceClient.php

3.RateService_v14.wsdl

require_once('fedex-common.php5');

$newline = "<br />";
//The WSDL is not included with the sample code.
//Please include and reference in $path_to_wsdl variable.
$path_to_wsdl = "RateService_v24.wsdl";

ini_set("soap.wsdl_cache_enabled", "0");

$client = new SoapClient($path_to_wsdl, array('trace' => 1)); 

$request['WebAuthenticationDetail'] = array(

    'UserCredential' => array(
       'Key' => getProperty('key'), 
       'Password' => getProperty('password')
    )
); 
$request['ClientDetail'] = array(
     'AccountNumber' => getProperty('shipaccount'), 
     'MeterNumber' => getProperty('meter')
);
$request['TransactionDetail'] = array('CustomerTransactionId' => ' *** Rate Request using PHP ***');
$request['Version'] = array(
    'ServiceId' => 'crs', 
    'Major' => '24', 
    'Intermediate' => '0', 
    'Minor' => '0'
);
$request['ReturnTransitAndCommit'] = true;
$request['RequestedShipment']['DropoffType'] = 'REGULAR_PICKUP'; // valid values REGULAR_PICKUP, REQUEST_COURIER, ...
$request['RequestedShipment']['ShipTimestamp'] = date('c');
$request['RequestedShipment']['ServiceType'] = 'INTERNATIONAL_PRIORITY'; // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
$request['RequestedShipment']['PackagingType'] = 'YOUR_PACKAGING'; // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
$request['RequestedShipment']['TotalInsuredValue']=array(
    'Ammount'=>100,
    'Currency'=>'USD'
);
$request['RequestedShipment']['Shipper'] = addShipper();
$request['RequestedShipment']['Recipient'] = addRecipient();
$request['RequestedShipment']['ShippingChargesPayment'] = addShippingChargesPayment();
$request['RequestedShipment']['PackageCount'] = '1';
$request['RequestedShipment']['RequestedPackageLineItems'] = addPackageLineItem1();

請試試這個代碼。

            <?php

            $xml = '<?xml version="1.0" encoding="UTF-8"?>';
            $xml .= '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://fedex.com/ws/rate/v13">';
            $xml .= '<SOAP-ENV:Body>';
            $xml .= '<ns1:RateRequest>';
            $xml .= '<ns1:WebAuthenticationDetail>';
            $xml .= '<ns1:UserCredential>';
            $xml .= '<ns1:Key></ns1:Key>';   // Use your Fedex Test Key Here
            $xml .= '<ns1:Password></ns1:Password>';  //// Use your Fedex Test Password Here
            $xml .= '</ns1:UserCredential>';
            $xml .= '</ns1:WebAuthenticationDetail>';
            $xml .= '<ns1:ClientDetail>';
            $xml .= '<ns1:AccountNumber></ns1:AccountNumber>';
            $xml .= '<ns1:MeterNumber></ns1:MeterNumber>';
            $xml .= '</ns1:ClientDetail>';
            $xml .= '<ns1:TransactionDetail>';
            $xml .= '<ns1:CustomerTransactionId> *** Rate Request v13 using PHP ***</ns1:CustomerTransactionId>';
            $xml .= '</ns1:TransactionDetail>';
            $xml .= '<ns1:Version>';
            $xml .= '<ns1:ServiceId>crs</ns1:ServiceId>';
            $xml .= '<ns1:Major>13</ns1:Major>';
            $xml .= '<ns1:Intermediate>0</ns1:Intermediate>';
            $xml .= '<ns1:Minor>0</ns1:Minor>';
            $xml .= '</ns1:Version>';
            $xml .= '<ns1:ReturnTransitAndCommit>true</ns1:ReturnTransitAndCommit>';
            $xml .= '<ns1:RequestedShipment>';
            $xml .= '<ns1:DropoffType>REGULAR_PICKUP</ns1:DropoffType>';
            $xml .= '<ns1:PackagingType>YOUR_PACKAGING</ns1:PackagingType>';
            $xml .= '<ns1:TotalInsuredValue>';
            $xml .= '<ns1:Currency>USD</ns1:Currency>';
            $xml .= '</ns1:TotalInsuredValue>';
            $xml .= '<ns1:Shipper>';
            $xml .= '<ns1:Contact>';
            $xml .= '<ns1:PersonName>Shipper Test Address</ns1:PersonName>';
            $xml .= '<ns1:CompanyName>Sample Company</ns1:CompanyName>';
            $xml .= '<ns1:PhoneNumber>800-5435-6789</ns1:PhoneNumber>';
            $xml .= '</ns1:Contact>';
            $xml .= '<ns1:Address>';
            $xml .= '<ns1:StreetLines>1300 Basswood Road</ns1:StreetLines>';
            $xml .= '<ns1:City></ns1:City>';
            $xml .= '<ns1:StateOrProvinceCode>IL</ns1:StateOrProvinceCode>';
            $xml .= '<ns1:PostalCode>60173</ns1:PostalCode>';
            $xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
            $xml .= '</ns1:Address>';
            $xml .= '</ns1:Shipper>';
            $xml .= '<ns1:Recipient>';
            $xml .= '<ns1:Contact>';
            $xml .= '<ns1:PersonName>Harish</ns1:PersonName>';
            $xml .= '<ns1:CompanyName>Test</ns1:CompanyName>';
            $xml .= '<ns1:PhoneNumber>98656789130</ns1:PhoneNumber>';
            $xml .= '</ns1:Contact>';
            $xml .= '<ns1:Address>';
            $xml .= '<ns1:StreetLines>32 wall street albany</ns1:StreetLines>';
            $xml .= '<ns1:City>Atlanta</ns1:City>';
            $xml .= '<ns1:StateOrProvinceCode>GA</ns1:StateOrProvinceCode>';
            $xml .= '<ns1:PostalCode>30318</ns1:PostalCode>';
            $xml .= '<ns1:CountryCode>US</ns1:CountryCode>';
            $xml .= '<ns1:Residential>true</ns1:Residential>';
            $xml .= '</ns1:Address>';
            $xml .= '</ns1:Recipient>';
            $xml .= '<ns1:ShippingChargesPayment>';
            $xml .= '<ns1:PaymentType>SENDER</ns1:PaymentType>';
            $xml .= '<ns1:Payor>';
            $xml .= '<ns1:ResponsibleParty>';
            $xml .= '<ns1:AccountNumber>510087100</ns1:AccountNumber>';
            $xml .= '</ns1:ResponsibleParty>';
            $xml .= '</ns1:Payor>';
            $xml .= '</ns1:ShippingChargesPayment>';
            $xml .= '<ns1:RateRequestTypes>LIST</ns1:RateRequestTypes>';
            $xml .= '<ns1:PackageCount>1</ns1:PackageCount>';
            $xml .= '<ns1:RequestedPackageLineItems>';
            $xml .= '<ns1:SequenceNumber>1</ns1:SequenceNumber>';
            $xml .= '<ns1:GroupPackageCount>1</ns1:GroupPackageCount>';
            $xml .= '<ns1:Weight>';
            $xml .= '<ns1:Units>LB</ns1:Units>';
            $xml .= '<ns1:Value>45</ns1:Value>';
            $xml .= '</ns1:Weight>';
            $xml .= '<ns1:Dimensions>';
            $xml .= '<ns1:Length>12</ns1:Length>';
            $xml .= '<ns1:Width>9</ns1:Width>';
            $xml .= '<ns1:Height>8</ns1:Height>';
            $xml .= '<ns1:Units>IN</ns1:Units>';
            $xml .= '</ns1:Dimensions>';
            $xml .= '</ns1:RequestedPackageLineItems>';
            $xml .= '</ns1:RequestedShipment>';
            $xml .= '</ns1:RateRequest>';
            $xml .= '</SOAP-ENV:Body>';
            $xml .= '</SOAP-ENV:Envelope>';


            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, 'https://wsbeta.fedex.com:443/web-services');
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
            curl_setopt($ch, CURLOPT_VERBOSE, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POST, 1);
            $result_xml = curl_exec($ch);
            $result_xml = str_replace(array(':','-'), '', $result_xml);
            $result = @simplexml_load_string($result_xml);

            echo "<pre>";
            print_r($result);
            echo "</pre>";
            ?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM