在使用 UPS API 的 ShipmentConfirmRequest 服务时,您可能会遇到如下错误:
xml <Error> <ErrorSeverity>Hard</ErrorSeverity> <ErrorCode>120416</ErrorCode> <ErrorDescription>A single billing option is required per shipment. </ErrorDescription> </Error>
- 导致此错误的原因是,在您的请求中缺少了 ShipmentCharge 元素。
-
解决方案
-
要解决此错误,您需要在 ShipmentConfirmRequest 请求中添加 ShipmentCharge 元素。该元素应位于 Shipment 元素内部,并且应包含以下子元素:
- Type:指定运费类型,可以是 01(运输)或 02(关税和税费)。
- BillShipper:指定要向其收取运费的托运人。
-
您可以在 UPS API 文档中找到有关 ShipmentCharge 元素的更多信息。
-
-
代码例子
-
以下是一个添加了 ShipmentCharge 元素的 ShipmentConfirmRequest 请求示例:
<ShipmentConfirmRequest> <Request> <TransactionReference> <CustomerContext>00001</CustomerContext> <XpciVersion>1.0001</XpciVersion> </TransactionReference> <RequestAction>ShipConfirm</RequestAction> <RequestOption>nonvalidate</RequestOption> </Request> <Shipment> <Description>00001</Description> <Shipper> <Name>HELICONIA</Name> <AttentionName>HELICONIA</AttentionName> <Address> <AddressLine1></AddressLine1> <AddressLine2></AddressLine2> <AddressLine3></AddressLine3> <City></City> <StateProvinceCode></StateProvinceCode> <CountryCode></CountryCode> <PostalCode></PostalCode> </Address> <PhoneNumber></PhoneNumber> <ShipperNumber>NUMBER</ShipperNumber> <TaxIdentificationNumber></TaxIdentificationNumber> <FaxNumber></FaxNumber> <EMailAddress></EMailAddress> </Shipper> <ShipTo> <CompanyName>Agriiolait</CompanyName> <AttentionName></AttentionName> <Address> <AddressLine1>Agriiolait</AddressLine1> <AddressLine2>69 rue de Chimay</AddressLine2> <AddressLine3></AddressLine3> <City>Wavre</City> <StateProvinceCode></StateProvinceCode> <CountryCode>BE</CountryCode> <PostalCode></PostalCode> </Address> <PhoneNumber>+32 10 588 558</PhoneNumber> <FaxNumber></FaxNumber> <EMailAddress>info@agroiilait.com</EMailAddress> <TaxIdentificationNumber></TaxIdentificationNumber> <LocationID></LocationID> </ShipTo> <Service> <Code>14</Code> <Description>Next Day Air</Description> </Service> <PaymentInformation> <ShipmentCharge> <Type>01</Type> <BillShipper> <AccountNumber>25AC57</AccountNumber> </BillShipper> </ShipmentCharge> </PaymentInformation> <Package> <Description></Description> <PackagingType> <Code>01</Code> <Description>UPS Letter</Description> </PackagingType> <Dimensions> <UnitOfMeasurement> <Code>IN</Code> <Description>Inches</Description> </UnitOfMeasurement> <Length>11.0</Length> <Width>110.0</Width> <Height>11.0</Height> </Dimensions> <PackageWeight> <UnitOfMeasurement> <Code>LBS</Code> <Description>Pounds</Description> </UnitOfMeasurement> <Weight>11.0</Weight> </PackageWeight> <ReferenceNumber> <Code>01</Code> <Value></Value> </ReferenceNumber> <ReferenceNumber> <Code>02</Code> <Value></Value> </ReferenceNumber> <PackageServiceOptions> <InsuredValue> <CurrencyCode>USD</CurrencyCode> <MonetaryValue>975.0</MonetaryValue> </InsuredValue> </PackageServiceOptions> </Package> <LabelSpecification> <LabelPrintMethod> <Code>GIF</Code> <Description>GIF</Description> </LabelPrintMethod> <HTTPUserAgent></HTTPUserAgent> <LabelImageFormat> <Code>GIF</Code> </LabelImageFormat> <LabelStockSize> <Height>8</Height> <Width>8</Width> </LabelStockSize> <LabelImageFormat> <Code>GIF</Code> <Description>GIF</Description> </LabelImageFormat> </LabelSpecification> </Shipment> </ShipmentConfirmRequest> -
将此请求发送给 UPS API 后,您应该能够成功创建运单并获取运单号。
-