6

I'm using FeDex API to Shipping Labels printing. Label for 1 package prints successfull, but when I trying print multiple-package I get an error:

stdClass Object
(
[Severity] => ERROR
[Source] => ship
[Code] => 2463
[Message] => The number of RequestedPackages in the RequestedShipment must be equal to 1
[LocalizedMessage] => The number of RequestedPackages in the RequestedShipment must be    equal to 1
)

In request I included TotalWeight, PackageCount, but it's helpn't

$request['WebAuthenticationDetail'] = array('UserCredential' =>array('Key' => $auth['key'], 'Password' => $auth['password']));
$request['ClientDetail'] = array('AccountNumber' => $auth['accountNumber'], 'MeterNumber' => $auth['meterNumber']);
$request['TransactionDetail'] = array('CustomerTransactionId' => '*** Ground Domestic Shipping Request v12 using PHP ***');
$request['Version'] = array('ServiceId' => 'ship', 'Major' => '12', 'Intermediate' => '1', 'Minor' => '0');
$request['RequestedShipment'] = array('ShipTimestamp' => date('c'),
                                      'DropoffType' => 'REGULAR_PICKUP', // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
                                      'ServiceType' => 'FEDEX_GROUND', // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
                                      'PackagingType' => 'YOUR_PACKAGING', // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
                                      'Shipper' => $this->addShipper(),
                                      'Recipient' => $this->recipient,
                                      'ShippingChargesPayment' => $this->addShippingChargesPayment(),
                                      'LabelSpecification' => $this->addLabelSpecification(), 
                                      'RateRequestTypes' => array('LIST'), // valid values ACCOUNT and LIST
                                      'PackageCount' => count($this->packages),
                                      'TotalWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'),
                                      'TotalShipmentWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'),
                                      'PackageDetail' => 'INDIVIDUAL_PACKAGES',                                        
                                      'RequestedPackageLineItems' => $this->packageLineItem//array('0' => $this->packageLineItem)
);      


$this->packageLineItem[] = array('SequenceNumber'=>$i,
              'GroupPackageCount' => count($this->packages),
              'MasterTrackingID' => '123123123123',
              'TotalShipmentWeight' => array('Value' => array_sum($this->packages), 'Units' => 'LB'),
              'Weight' => array('Value' => $this->packages[$i-1], //weight!!!!!!!!!!!!!
                                'Units' => 'LB'),
              'CustomerReferences' => array('0' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 
                                                         'Value' => 'GR4567892'), // valid values CUSTOMER_REFERENCE, INVOICE_NUMBER, P_O_NUMBER and SHIPMENT_INTEGRITY
                                            '1' => array('CustomerReferenceType' => 'INVOICE_NUMBER', 
                                                         'Value' => 'INV4567892'),
                                            '2' => array('CustomerReferenceType' => 'P_O_NUMBER', 
                                                         'Value' => 'PO4567892')),
              'SpecialServicesRequested' => array('SpecialServiceTypes' => array('COD'),
                                                  'CodDetail' => array('CodCollectionAmount' => array('Currency' => 'USD', 'Amount' => 150),
                                                                       'CollectionType' => 'ANY')// ANY, GUARANTEED_FUNDS
                                                 )
 );

Does anyone know how to be a valid request?

stan
  • 83
  • 1
  • 1
  • 7
  • 1
    Did you ever get an answer for this? I'm currently receiving the same error, despite having "MasterTrackingId" correct. – user766987 Apr 22 '13 at 17:43

3 Answers3

19

There is a difference between the FedEx Rate API and the FedEx Shipping API. You can rate multiple packages using one SOAP request; however, to ship an Multiple Pieces Shipment (MPS), you have to perform a shipping request for each one of the packages.

The first package (the package in the first request), will be your Master containing the master tracking number. Once you have this master tracking number, you have to attach it to the shipping request of the remaining packages. Please, refer to the latest FedEx Developer Guide for more information about MPS shipments and download the example of performing an Express domestic MPS shipment from the FedEx developer portal.

Something to watch out is that the shipping process does not occur as a transaction, so if you are trying to ship 3 packages, and package 1 and 2 are submitted successfully, but package 3 fails for so unknown reason, you are responsible for canceling package 1 and 2 or resubmitting package 3. I would recommend anyone to validate the shipment (using the same shipping API) before creating the actual shipment.

Best!

Ozzy Garcia
  • 656
  • 5
  • 8
  • The page at https://www.fedex.com/us/developer/WebHelp/fsms/1401/dvg/DVG-WebHelp/2_7_4_1_Single_Shot_Shipping_Method.htm explains single shot shipping method for multiple piece shipment but I keep getting this same error. Any idea why? – trss Apr 15 '17 at 11:31
  • I mean, your answer suggests that this is not possible. Could it be that this is no longer supported? – trss Apr 15 '17 at 11:51
  • @ozzy I cant figure out where to attach the *Master Tracking* to the shipping request of the remaining packages? Im doing C# but any code example would be fine – Morris S Mar 22 '18 at 17:06
  • Will I be charged for each package separately or only the first one will have Charge field set? – Vladimir Mischenko Jul 17 '18 at 10:08
  • Is is possible to get a quote for multiple packages of different types? – Sebastián Odena Apr 17 '19 at 17:43
  • is there a code somewhere here? we're on testing mode. I want to generate shipping 2 shipping label. btw im using this gem [fedex](https://github.com/jazminschroeder/fedex), so what I did is loop thru all packages and on the first loop get the master tracking number and pass the master tracking number on the next call. is that the right way? I mean is loop the right way? – aRtoo Jun 13 '19 at 22:17
  • 1
    I've googled the FedEx Developer Guide and haven't been able to find any actual example of MPS soap requests. – TKoL Feb 12 '20 at 09:08
  • I'm working on this myself atm, the monster dev guide from 2019 (currently the most up-to-date as of this comment). The SOAP is not explicitly written out, but 191 is where the section on MPS starts. Looking at the pdf, the MasterTrackingId should be added to the package, but looking at the wsld, it's actually on the Shipment directly on RequestedShipment. The pdf and wsld line up and it looks like RequestedPackageLineItem/SequenceNumber on the package is where the SN goes. I will edit if this is wrong. – ginn Oct 26 '21 at 01:27
1

The FeDex manual has an error: "MasterTrackingID" is wrong. "MasterTrackingId" is right.

Flexo
  • 87,323
  • 22
  • 191
  • 272
1

I've gotten an MPS working on the test server. I'm using python and this lovely wrapper, so it's not a full-on SOAP write up, but... where shipment is basically:

SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP- ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="http://fedex.com/ws/ship/v25">
<SOAP-ENV:Body>
<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v25">
<WebAuthenticationDetail> <ParentCredential>
<Key>Hb1TfWMygUh7bbHP</Key>
<Password>u0mnYl8d6FRQK5Ot8SyxMXVqq</Password> </ParentCredential>
<UserCredential>
<Key>INPUT YOUR INFORMATION</Key>
<Password> INPUT YOUR INFORMATION </Password> </UserCredential>
</WebAuthenticationDetail> <ClientDetail>
<AccountNumber>XXXXXXXXX</AccountNumber>
<MeterNumber>XXXXXX</MeterNumber> </ClientDetail>
<TransactionDetail>
<CustomerTransactionId>ProcessShipmentRequest_2264</CustomerTransactionId> </TransactionDetail>
<Version>
<ServiceId>ship</ServiceId> <Major>25</Major> <Intermediate>0</Intermediate>
<Minor>0</Minor> </Version> <RequestedShipment>

and whatever closures are needed, we've got the basic shipment crap and then...

shipment.RequestedShipment.TotalWeight.Value
shipment.RequestedShipment.TotalWeight.Units
shipment.RequestedShipment.PackageCount

ON YOUR FIRST SHIPMENT. Have the whatever is your first package to in that shipment request, but include SequenceNumber = 1:

<RequestedPackageLineItems>
<SequenceNumber>1</SequenceNumber> 
<Weight>
<Units>LB</Units>
<Value>20.0</Value> 
</Weight> 
<Dimensions>
<Length>12</Length> 
<Width>12</Width> 
<Height>12</Height> 
<Units>IN</Units>
</Dimensions> 
</RequestedPackageLineItems>

Submit that shipment w/ package request. In that shipment's response, you'll take CompletedShipmentDetail.MasterTrackingId. In the subsequent shipments, you'll just form them as usual, EXCEPT, you'll include a

RequestedShipment.MasterTrackingId.TrackingIdType

and

RequestedShipment.MasterTrackingId.MasterTrackingId

where the MasterTrackingId is that taken from that first shipment; the WDSL will have the list of TrackingIdType. I think just using 'FEDEX' is ok. The shipment weight and package count will just be like a normal shipment--the package weight and 1. The package line item's number will increment until you reach the PackageCount.

I hope this adds to @Ozzy Garcia 's answer! They certainly shed more light on this than FedEx's documentation!

ginn
  • 101
  • 8