我正在使用FeDex API运送标签。 1个包装的标签可以成功打印,但是当我尝试打印多个包装时,出现错误:

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
)

在请求中,我包括TotalWeight,PackageCount,但它没有帮助
$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
                                                 )
 );

有人知道如何成为一个有效的请求吗?

最佳答案

FedEx Rate API FedEx Shipping API 之间是有区别的。您可以使用一个SOAP请求对多个软件包进行评分。但是,要运输多件 cargo 运输(MPS),您必须为每个包裹执行运输请求。

第一个包裹(第一个请求中的包裹)将是您的,其中包含主跟踪号。一旦有了该主跟踪号,就必须将其附加到其余包裹的运输请求中。请引用最新的 FedEx开发人员指南,以获取有关MPS发货的更多信息,并从FedEx开发人员门户下载执行Express国内MPS发货的示例。

需要注意的是,运送过程不会作为交易发生,因此,如果您尝试运送3个包裹,并且包裹1和2成功提交,但是包裹3由于未知原因而失败,则您有责任取消包裹1和2或重新提交包裹3。我建议任何人在创建实际 cargo 之前验证 cargo (使用相同的 cargo API)。

最好的!

关于php - Fedex API。运输标签。多件货件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14040137/

10-10 13:58