簡體   English   中英

在php中使用UPS Rate API時如何捕獲交貨日期?

[英]How to capture delivery date when using UPS Rate API in php?

我正在使用此端點請求估計費率https://wwwcie.ups.com/webservices/Rate

我注意到 XML 響應不包含任何交付日期。 不過,我確實看到了 BusinessDaysInTransit。 但是,我不確定我們是否有責任進行手動編碼以確定交貨日期。 我在他們的 api 文檔中找不到任何內容。

您必須改用Time In Transit API。 Rate API 不提供預計交貨日期。

在此處輸入圖片說明

我知道這是舊的,但要在費率調用中獲得它,您需要將 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 開發人員指南,您將需要結合來自 WebServices 指南的信息來了解您缺少哪些容器,因為 JSON 文檔很差。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM