Array structure for specifying the Fedex One rate using the Fedex API RateService

I have a working request to get rates for my shipment using Fedex standard rates, but I want to use a dedicated Fedex One Rate option so that I can get their fixed rate quotes.

Unfortunately, their sample code does not indicate how to specify that the rate request should use Fedex One Rate, and I was completely unable to mentally make out through the vomit xml which is WSDL. I've tried several different array structures to pass (which I assume) are the right variables, but nothing seems to work.

I created two html versions of WSDL using third party generators (neither of them are very useful, but you can probably read them better than me).

The first one includes wsdl directly with data types associated with their definitions: http://inadaydevelopment.com/stackoverflow/fedex/RateService_v16.html

The second is simpler, it just provides a hierarchy in a more linear manner with valid values ​​at each level: http://inadaydevelopment.com/stackoverflow/fedex/RateService_v16_other.html

As far as I can tell, there are two ways / places I can declare that I want my course rate to use One Rate:

1) $request['VariableOptions'] = 'FEDEX_ONE_RATE';

      

and

2) $request['RequestedShipment']['SpecialServicesRequested'] = array(
    'SpecialServiceTypes' => array('FEDEX_ONE_RATE')
);

      

When I use (1) I get a successful response that includes a list of prices, but they are not One Rate prices. These are standard prices.

When I use (2) I get an error response:

stdClass Object
(
    [HighestSeverity] => WARNING
    [Notifications] => stdClass Object
        (
            [Severity] => WARNING
            [Source] => crs
            [Code] => 556
            [Message] => There are no valid services available. 
            [LocalizedMessage] => There are no valid services available. 
        )

    [TransactionDetail] => stdClass Object
        (
            [CustomerTransactionId] =>  *** Service Availability Request v5.1 using PHP ***
        )

    [Version] => stdClass Object
        (
            [ServiceId] => crs
            [Major] => 16
            [Intermediate] => 0
            [Minor] => 0
        )

)

      

If I use both (1) and (2), I get an error (2) as well as an additional warning that I have set One Rate in two different ways and that (2) will override (1).

Here is my complete array of requests:

array (
  'WebAuthenticationDetail' => 
  array (
    'UserCredential' => 
    array (
      'Key' => 'xxx',
      'Password' => 'xxx',
    ),
  ),
  'ClientDetail' => 
  array (
    'AccountNumber' => 'xxx',
    'MeterNumber' => 'xxx',
  ),
  'TransactionDetail' => 
  array (
    'CustomerTransactionId' => ' *** Service Availability Request v5.1 using PHP ***',
  ),
  'Version' => 
  array (
    'ServiceId' => 'crs',
    'Major' => '16',
    'Intermediate' => '0',
    'Minor' => '0',
  ),
  'ReturnTransitAndCommit' => true,
  'RequestedShipment' => 
  array (
    'DropoffType' => 'STATION',
    'ShipTimestamp' => '2015-06-14T14:13:46-07:00',
    'Shipper' => 
    array (
      'Contact' => 
      array (
        'PersonName' => 'Kenny Wyland',
        'CompanyName' => 'K2 Cashflow',
        'PhoneNumber' => 'xxxxxxxxxx',
      ),
      'Address' => 
      array (
        'StreetLines' => 
        array (
          0 => 'xxxx E xxxxx St',
        ),
        'City' => 'Long Beach',
        'StateOrProvinceCode' => 'CA',
        'PostalCode' => '90805',
        'CountryCode' => 'US',
      ),
    ),
    'Recipient' => 
    array (
      'Contact' => 
      array (
        'PersonName' => 'Bob Smith',
        'PhoneNumber' => 'xxx-xxx-xxxx',
      ),
      'Address' => 
      array (
        'StreetLines' => 
        array (
          0 => 'xxxxx xxxxxxx Rd',
        ),
        'City' => 'Corona',
        'StateOrProvinceCode' => 'CA',
        'PostalCode' => '92883',
        'CountryCode' => 'US',
        'Residential' => true,
      ),
    ),
    'ShippingChargesPayment' => 
    array (
      'PaymentType' => 'SENDER',
      'Payor' => 
      array (
        'ResponsibleParty' => 
        array (
          'AccountNumber' => 'xxxx',
          'Contact' => NULL,
          'Address' => 
          array (
            'CountryCode' => 'US',
          ),
        ),
      ),
    ),
    'PackageCount' => '1',
    'RequestedPackageLineItems' => 
    array (
      0 => 
      array (
        'SequenceNumber' => 1,
        'GroupPackageCount' => 1,
        'Weight' => 
        array (
          'Value' => 0.01,
          'Units' => 'LB',
        ),
      ),
    ),
    'SpecialServicesRequested' => 
    array (
      'SpecialServiceTypes' => 
      array (
        0 => 'FEDEX_ONE_RATE',
      ),
    ),
  ),
)

      

+3


source to share


1 answer


The document https://www.fedex.com/templates/components/apps/wpor/secure/downloads/pdf/201408/RateServicesWSDLGuide_v2014.pdf in clause 2.4.4 states that there are several requirements to get the One Rate price:

  • Specify "FEDEX_ONE_RATE" ShipmentSpecialService.

What you already have (the one you are using is listed in FedEx Freight Priority and FedEx Freight Economy, clause 2.2.4.1).

Next requirement:

  1. Specify one of the following types of packaging:

FEDEX_SMALL_BOX

....

In code, it should be:

$request['RequestedShipment']['PackagingType'] = 'FEDEX_SMALL_BOX';

      

After that, the third requirement appears:



  1. Include US source and US destination.

Which you already have in your code.

And the fourth requirement:

  1. Specify one of the following FedEx Express services:

FIRST_OVERNIGHT

...

What's in the code:

$request['RequestedShipment']['ServiceType'] = 'FIRST_OVERNIGHT';

      

Also note the note at the end:

* Note. Web service clients can request One Rate and Weight (no single rate) in the same RateRequest by specifying "FEDEX_ONE_RATE" as the ServiceOptionType in RateRequest.variableOptions.

+2


source







All Articles