我试图获取两个地点之间包裹的运费。 在请求数组中,我创建了适当的结构,并在适当的位置提供了NumberOfPieces。
stdClass Object
(
//OTHER ELEMENTS REDACTED HERE
[RequestedShipment] => stdClass Object
(
[Commodities] => Array
(
[NumberOfPieces] => 1
[Description] => Dog Meat
[CountryOfManufacture] => US
[Weight] => Array
(
[Units] => LB
[Value] => 20
)
[Quantity] => 1
[QuantityUnits] => EA
[UnitPrice] => Array
(
[Currency] => USD
[Amount] => 20
)
[CustomsValue] => Array
(
[Currency] => USD
[Amount] => 100
)
)
现在的问题是,API的响应表明我输入的计件数无效。
stdClass Object
(
[HighestSeverity] => ERROR
[Notifications] => stdClass Object
(
[Severity] => ERROR
[Source] => crs
[Code] => 546
[Message] => Invalid piece count.
[LocalizedMessage] => Invalid piece count.
)
[Version] => stdClass Object
(
[ServiceId] => crs
[Major] => 16
[Intermediate] => 0
[Minor] => 0
)
)
我曾尝试在网上搜寻可能的解决方案,但徒劳无功。有帮助吗?
答案 0 :(得分:0)
今天最终面对同样的问题。发货结构需要在RequestedShipment内部定义发货人和收件人。以下内容使我能够成功获得费率:
Array
(
[WebAuthenticationDetail] => Array(...)
[ClientDetail] => Array(...)
[Version] => Array(...)
[RequestedShipment] => Array
(
[Shipper] => Array(...)
[Recipient] => Array(...)
[PackageCount] => 1
[RequestedPackageLineItems] => Array(...)
)
)