1

I am trying to integrate UPS API using XML to pull all the available shipping types with their shipping charge for a given shipping address. I am using this XML and it works fine for a given shipping type, I want to get all the available shipping type. Can anyone help me with the correct xml to use?

 $data ="<?xml version=\"1.0\"?>  
        <AccessRequest xml:lang=\"en-US\">  
            <AccessLicenseNumber>$this->AccessLicenseNumber</AccessLicenseNumber>  
            <UserId>$this->UserID</UserId>  
            <Password>$this->Password</Password>  
        </AccessRequest>  
        <?xml version=\"1.0\"?>  
        <RatingServiceSelectionRequest xml:lang=\"en-US\">  
            <Request>  
            <TransactionReference>  
                <CustomerContext>Bare Bones Rate Request</CustomerContext>  
                <XpciVersion>1.0001</XpciVersion>  
            </TransactionReference>  
            <RequestAction>Rate</RequestAction>  
            <RequestOption>Rate</RequestOption>  
            </Request>  
        <PickupType>  
            <Code>01</Code>  
        </PickupType>  
        <Shipment>  
            <Shipper>  
            <Address>  
                <PostalCode>ZIP</PostalCode>  
                <CountryCode>US</CountryCode> 
                <AddressLine1>ADDRESS1</AddressLine1>
                <City>CITY</City>
                <StateProvinceCode>STATE</StateProvinceCode>
            </Address>  
            <ShipperNumber>$this->shipperNumber</ShipperNumber>  
            </Shipper>  
            <ShipTo>  
            <Address>  
                <PostalCode>$dest_zip</PostalCode>  
                <CountryCode>US</CountryCode>  
                <AddressLine1>$dest_addr</AddressLine1>
                <City>$dest_city</City>
                <StateProvinceCode>$dest_state</StateProvinceCode>
            </Address>  
            </ShipTo>  
            <ShipFrom>  
            <Address>  
                <PostalCode>$this->sourceZip</PostalCode>  
                <CountryCode>US</CountryCode>  
            </Address>  
            </ShipFrom>  
            <Service>  
            <Code>$service</Code>  
            </Service>  
            <Package>  
            <PackagingType>  
                <Code>02</Code>  
            </PackagingType>  
            <Dimensions>  
                <UnitOfMeasurement>  
                <Code>$this->dimensionsUnits</Code>     
                </UnitOfMeasurement>  
                <Length>$length</Length>  
                <Width>$width</Width>  
                <Height>$height</Height>  
            </Dimensions>  
            <PackageWeight>  
                <UnitOfMeasurement>  
                <Code>$this->weightUnits</Code>  
                </UnitOfMeasurement>  
                <Weight>$weight</Weight>  
            </PackageWeight>  
            </Package>  
        </Shipment>  
        </RatingServiceSelectionRequest>";  

Thanks!

Developer
  • 83
  • 1
  • 10

1 Answers1

1

I got the answer to this, in case someone else wants to know.

We just need to change this portion in the XML

<RequestOption>Rate</RequestOption> 

to <RequestOption>Shop</RequestOption> And it gives us rate for all the available shipping types.

Developer
  • 83
  • 1
  • 10