如何在php中使用UPS Rate API时捕获交货日期?

时间:2014-10-12 00:31:29

标签: php shipping fedex ups

我使用此端点请求估算的费率 https://wwwcie.ups.com/webservices/Rate

我注意到XML响应并不包含任何交付日期。我确实看到了BusinessDaysInTransit。但是,我不确定是否负责进行手动编码以确定交货日期。我在他们的api文档中找不到任何内容。

2 个答案:

答案 0 :(得分:0)

您必须使用 Time In Transit API。 Rate API不提供预计的交付日期。

enter image description here

答案 1 :(得分:0)

我知道这已经很老了,但是要在费率通话中获得此权限,您需要将RequestOption更改为“ RateTimeInTransit”,然后将DeliveryTimeInformation容器添加到请求中:

    {
       "UPSSecurity":{
          "UsernameToken":{
             "Username":"removed",
             "Password":"removed"
          },
          "ServiceAccessToken":{
             "AccessLicenseNumber":"removed"
          }
       },
       "RateRequest":{
          "Request":{
             "RequestOption":"RateTimeInTransit",
             "TransactionReference":{
                "CustomerContext":"ORDER123"
             }
          },
          "Shipment":{
             "Shipper":{
                "Name":"ShipperName",
                "ShipperNumber":"removed",
                "Address":{
                   "AddressLine":[
                      "123 Sesame St"
                   ],
                   "City":"Nibley",
                   "StateProvinceCode":"UT",
                   "PostalCode":"84321",
                   "CountryCode":"US"
                }
             },
             "ShipTo":{
                "Name":null,
                "AttentionName":"Ship to Name",
                "Address":{
                   "AddressLine":[
                      "123 RealAddress ST"
                   ],
                   "City":"Hyrum",
                   "StateProvinceCode":"UT",
                   "PostalCode":"84319",
                   "CountryCode":"US",
                   "ResidentialAddressIndicator":"Y"
                }
             },
             "ShipFrom":{
                "Name":"Ima Shipper",
                "Address":{
                   "AddressLine":[
                      "123 Sesame St"
                   ],
                   "City":"Nibley",
                   "StateProvinceCode":"UT",
                   "PostalCode":"84321",
                   "CountryCode":"US"
                }
             },
             "Service":{
                "Code":"03"
             },
             "Package":{
                "PackagingType":{
                   "Code":"02"
                },
                "Dimensions":{
                   "UnitOfMeasurement":{
                      "Code":"IN",
                      "Description":"inches"
                   },
                   "Length":"5",
                   "Width":"4",
                   "Height":"3"
                },
                "PackageWeight":{
                   "UnitOfMeasurement":{
                      "Code":"Lbs",
                      "Description":"pounds"
                   },
                   "Weight":"1"
                }
             },
             "ShipmentRatingOptions":{
                "NegotiatedRatesIndicator":"Y",
                "RateChartIndicator":"Y"
             },
             "DeliveryTimeInformation":{
                "PackageBillType": "03",
                "Pickup":{
                    "Date":"20191224"
                }
          }
       }
    }

如果使用《 UPS JSON开发人员指南》,您将需要结合Web服务指南中的信息,以了解由于JSON文档不佳而缺少哪些容器。