Fedex API为费率提供错误值

时间:2015-04-15 07:56:06

标签: php fedex

为什么我从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
                                )

                        )

                )

        )

2 个答案:

答案 0 :(得分:1)

根据您的要求,有两件事引起了我的注意:

  1. 收件人地址不包含州值。我不完全确定FedEx是否需要它,但许多运营商确实需要州代码。
  2. 包装尺寸为100x100x100。根据{{​​3}},这超过了最大值。周长限制,因此你需要使用FedEx Freight,这是一个不同的API。这将解释“无效服务”错误。

答案 1 :(得分:0)

对我来说,问题在于FedexRateServiceRequest需要Zip,CountryCode和State。没有状态,我会遇到同样的错误。

rate_request.RequestedShipment.Recipient.Address.StateOrProvinceCode = 'CA'