Fedex API 给出费率的错误值
Fedex API giving error value for rates
为什么我会收到 FedEx API 的回复?当到处搜索时,我得到的答复是您输入错误的托运人编号,但我输入正确。我在
收到回复
$response = $client ->getRates($request);
stdClass Object
(
[HighestSeverity] => WARNING
[Notifications] => Array
(
[0] => stdClass Object
(
[Severity] => WARNING
[Source] => crs
[Code] => 556
[Message] => There are no valid services available.
[LocalizedMessage] => There are no valid services available.
)
[1] => stdClass Object
(
[Severity] => NOTE
[Source] => crs
[Code] => 820
[Message] => The destination state/province code has been changed.
[LocalizedMessage] => The destination state/province code has been changed.
)
)
[TransactionDetail] => stdClass Object
(
[CustomerTransactionId] => *** Rate Available Services Request v7 using PHP ***
)
[Version] => stdClass Object
(
[ServiceId] => crs
[Major] => 7
[Intermediate] => 0
[Minor] => 0
)
)
我要求如下发货
[RequestedShipment] => Array
(
[DropoffType] => REGULAR_PICKUP
[ShipTimestamp] => 2015-04-15T13:19:32+05:30
[Shipper] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] => 1202 Chalet Ln
)
[City] =>
[StateOrProvinceCode] => AR
[PostalCode] => 72601
[CountryCode] => US
)
)
[Recipient] => Array
(
[Address] => Array
(
[PostalCode] => 97005
[CountryCode] => US
)
)
[ShippingChargesPayment] => Array
(
[PaymentType] => SENDER
[Payor] => Array
(
[AccountNumber] => 510087623
[CountryCode] => US
)
)
[RateRequestTypes] => LIST
[PackageCount] => 1
[PackageDetail] => INDIVIDUAL_PACKAGES
[RequestedPackageLineItems] => Array
(
[0] => Array
(
[Weight] => Array
(
[Value] => 1.25
[Units] => LB
)
[Dimensions] => Array
(
[Length] => 100
[Width] => 100
[Height] => 100
[Units] => IN
)
)
)
)
你的请求引起了我的注意:
- 收件人地址不包含状态值。我不完全确定 FedEx 是否要求它,但许多承运人确实需要州代码。
- 包装尺寸为 100x100x100。根据 http://images.fedex.com/us/services/pdf/packaging/GrlPkgGuidelines_fxcom.pdf,这超过了最大值。周长限制,因此您需要使用 FedEx Freight,这是不同的 API。这将解释 "no valid services" 错误。
对我来说,问题是 FedexRateServiceRequest 需要 Zip、CountryCode 和 State。没有状态我得到了同样的错误。
rate_request.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'CA'
为什么我会收到 FedEx API 的回复?当到处搜索时,我得到的答复是您输入错误的托运人编号,但我输入正确。我在
收到回复$response = $client ->getRates($request);
stdClass Object
(
[HighestSeverity] => WARNING
[Notifications] => Array
(
[0] => stdClass Object
(
[Severity] => WARNING
[Source] => crs
[Code] => 556
[Message] => There are no valid services available.
[LocalizedMessage] => There are no valid services available.
)
[1] => stdClass Object
(
[Severity] => NOTE
[Source] => crs
[Code] => 820
[Message] => The destination state/province code has been changed.
[LocalizedMessage] => The destination state/province code has been changed.
)
)
[TransactionDetail] => stdClass Object
(
[CustomerTransactionId] => *** Rate Available Services Request v7 using PHP ***
)
[Version] => stdClass Object
(
[ServiceId] => crs
[Major] => 7
[Intermediate] => 0
[Minor] => 0
)
)
我要求如下发货
[RequestedShipment] => Array
(
[DropoffType] => REGULAR_PICKUP
[ShipTimestamp] => 2015-04-15T13:19:32+05:30
[Shipper] => Array
(
[Address] => Array
(
[StreetLines] => Array
(
[0] => 1202 Chalet Ln
)
[City] =>
[StateOrProvinceCode] => AR
[PostalCode] => 72601
[CountryCode] => US
)
)
[Recipient] => Array
(
[Address] => Array
(
[PostalCode] => 97005
[CountryCode] => US
)
)
[ShippingChargesPayment] => Array
(
[PaymentType] => SENDER
[Payor] => Array
(
[AccountNumber] => 510087623
[CountryCode] => US
)
)
[RateRequestTypes] => LIST
[PackageCount] => 1
[PackageDetail] => INDIVIDUAL_PACKAGES
[RequestedPackageLineItems] => Array
(
[0] => Array
(
[Weight] => Array
(
[Value] => 1.25
[Units] => LB
)
[Dimensions] => Array
(
[Length] => 100
[Width] => 100
[Height] => 100
[Units] => IN
)
)
)
)
你的请求引起了我的注意:
- 收件人地址不包含状态值。我不完全确定 FedEx 是否要求它,但许多承运人确实需要州代码。
- 包装尺寸为 100x100x100。根据 http://images.fedex.com/us/services/pdf/packaging/GrlPkgGuidelines_fxcom.pdf,这超过了最大值。周长限制,因此您需要使用 FedEx Freight,这是不同的 API。这将解释 "no valid services" 错误。
对我来说,问题是 FedexRateServiceRequest 需要 Zip、CountryCode 和 State。没有状态我得到了同样的错误。
rate_request.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'CA'