0

I am using UPS API in Magento for CANADA and USA country, if I am passing the same request parameters for Canada it works fine and gets a response as aspected, but if I pass US address in <ShipTo> parameter in UPS API request. it throws the error invalid shipment contents value

Here is UPS API Request. The below request is passing. It works fine for Canada address, but it does not work for the US address.

Can anyone address me what I am going to wrong below request for US address?

Request

<AccessRequest xml:lang="en-US">    
  <AccessLicenseNumber>******</AccessLicenseNumber> 
  <UserId>*****</UserId>    
  <Password>*****</Password>    
</AccessRequest><?xml version="1.0"?>   
<RatingServiceSelectionRequest xml:lang="en-US">    
  <Request> 
    <TransactionReference>  
      <CustomerContext>Rating and Service</CustomerContext> 
      <XpciVersion>1.0</XpciVersion>    
    </TransactionReference> 
    <RequestAction>Rate</RequestAction> 
    <RequestOption>Shoptimeintransit</RequestOption>    
  </Request>    
  <PickupType>  
          <Code>01</Code>   
          <Description>Regular Daily Pickup</Description>   
  </PickupType> 
  <Shipment>      <Shipper><ShipperNumber>****</ShipperNumber>      <Address>   
          <City>Scarborough</City>  
          <PostalCode>M1G 0A6</PostalCode>  
          <CountryCode>CA</CountryCode> 
          <StateProvinceCode>ON</StateProvinceCode> 
      </Address>    
    </Shipper>  
    <ShipTo>    
      <Address> 
          <PostalCode>14304</PostalCode>    
          <CountryCode>US</CountryCode> 
          <ResidentialAddress>02</ResidentialAddress>   
          <StateProvinceCode>NY</StateProvinceCode>      </Address> 
    </ShipTo>   
    <ShipFrom>  
      <Address> 
          <PostalCode>M1G 0A6</PostalCode>  
          <CountryCode>CA</CountryCode> 
          <StateProvinceCode>ON</StateProvinceCode> 
      </Address>    
    </ShipFrom> 
    <DeliveryTimeInformation>   
    <PackageBillType>03</PackageBillType>   
</DeliveryTimeInformation>  
    <Package>   
      <PackagingType>   
        <Code>00</Code> 
      </PackagingType>  
      <PackageWeight>   
        <UnitOfMeasurement> 
          <Code>LBS</Code>  
        </UnitOfMeasurement>    
        <Weight>0.2</Weight>    
      </PackageWeight>  
    </Package>  
    <ShipmentTotalWeight>   
    <UnitOfMeasurement> 
        <Code>LBS</Code>    
    </UnitOfMeasurement>    
    <Weight>0.2</Weight>    
    </ShipmentTotalWeight><RateInformation><NegotiatedRatesIndicator/></RateInformation>      </Shipment>   
    </RatingServiceSelectionRequest>

RESPONSE

<RatingServiceSelectionResponse>
    <Response>
        <TransactionReference>
            <CustomerContext>Rating and Service</CustomerContext>
            <XpciVersion>1.0</XpciVersion>
        </TransactionReference>
        <ResponseStatusCode>0</ResponseStatusCode>
        <ResponseStatusDescription>Failure</ResponseStatusDescription>
        <Error>
            <ErrorSeverity>Hard</ErrorSeverity>
            <ErrorCode>111549</ErrorCode>
            <ErrorDescription>Invalid Shipment Contents Value.</ErrorDescription>
        </Error>
    </Response>
</RatingServiceSelectionResponse>

1 Answer 1

0

It seems pretty frequent error when using this API. And I found a quite useful solution. I applied and now it's working fine on my website.

Requires to add new <InvoiceLineTotal> section in <shipment> section and <city> is required in <ShipTo> section.

1
  • it looks like you are the Magento company,and I think you copied from this link medium.com/@soni.manthan0/…, so at least mention the author or link for authenticate, I advice you do not copy, thank you for your answer Commented Jan 7, 2022 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.