Search code examples
phpxmlapiups

UPS Rates API gives low price


I have a PHP/XML script to get rate quotes from UPS. I've set it up according to the UPS Rates documentation and it seems to work, but the prices I get are consistently lower (by 10-20%) than what I get if I login to UPS and enter the same info/service etc. Without putting the whole XML request here, I am passing:

Shipper postal, country, account number
Shipto postal, country
shipfrom postal, country
Service code
Payment Information - prepaid
Packagingtype code
Dimensions - length, width, height
weight

Has anyone seen this and figured out a solution? I'm guessing there's a parameter that defaults differently on the UPS site from the API, but I can't find it.


Solution

  • I had this same problem. A little testing showed I wasn't specifying the pickup type in my request, and I believe it was defaulting to "01" (Daily Pickup). When I specified a pickup type of "03" (Customer Counter), the values returned from the API matched the website exactly.

    <?xml version="1.0"?>
    <RatingServiceSelectionRequest xml:lang="en-US">
      <Request>
        <RequestAction>Rate</RequestAction>
        <RequestOption>Shop</RequestOption>
      </Request>
      <PickupType>      <-- Make sure you are
        <Code>03</Code> <-- specifying the
      </PickupType>     <-- pickup type
      <Shipment>
        ...
      </Shipment>
    </RatingServiceSelectionRequest>
    

    Download the documentation from here, and reference Rating Package - XML Developers Guide.pdf in the ZIP.