UPS surepost API

6.9k views Asked by At

I am trying to integrate UPS SurePost API in PHP to get the Rates for SurePost services. I have no idea where to get the API from and how to integrate it.

Any help would be greatly appreciated.

Thanks

4

There are 4 answers

2
jayesh vaja On BEST ANSWER

Service Code 93 Is for Surepost

<AccessLicenseNumber>xxxx</AccessLicenseNumber>
             <UserId>xxxx</UserId>
             <Password>xxxx</Password>
         </AccessRequest>
             <RatingServiceSelectionRequest>
                 <Request>
                    <TransactionReference>
                         <CustomerContext>Bare Bones Rate Request</CustomerContext>
                         <XpciVersion>1.0001</XpciVersion>
                     </TransactionReference>
                    <RequestAction>Rate</RequestAction>
                    <RequestOption>Rate</RequestOption>
                </Request>
                 <PickupType>
                     <Code>02</Code>
                 </PickupType>
                 <Shipment>
                     <Shipper>
                         <Address>
                             <PostalCode>123456</PostalCode>
                             <CountryCode>US</CountryCode>
                         </Address>
                         <ShipperNumber>123456</ShipperNumber>
                     </Shipper>             
                     <ShipTo>
                         <Address>
                             <PostalCode>123123</PostalCode>
                             <StateProvinceCode>AL</StateProvinceCode> 
                             <CountryCode>US</CountryCode>                           
                         </Address>
                     </ShipTo>              
                     <ShipFrom>
                         <Address>
                             <PostalCode>123123</PostalCode>
                             <StateProvinceCode>123</StateProvinceCode>
                             <CountryCode>US</CountryCode>
                         </Address>
                     </ShipFrom>                
                     <Service>
                         <Code>93</Code>
                     </Service>
                     <Package>
                        <PackagingType>
                         <Code>02</Code>
                     </PackagingType>
                     <Description>Rate Shopping</Description>
<Dimensions><UnitOfMeasurement><Code>IN</Code></UnitOfMeasurement><Length>20</Length><Width>10</Width><Height>10</Height></Dimensions>
<PackageWeight><UnitOfMeasurement>
                         <Code>LBS</Code>
                     </UnitOfMeasurement>
                     <Weight>20.20</Weight>
                 </PackageWeight>
                </Package>              
             <RateInformation><NegotiatedRatesIndicator/></RateInformation></Shipment></RatingServiceSelectionRequest>
0
recurse On

To ship packages via UPS SurePost service, you must first have a UPS Account along with a UPS Developer Account to gain access to their XML API.

https://www.ups.com/upsdeveloperkit

The example by @ayesh is the format of the xml payload you would send with your request for Rates, which with the correct SERVICE CODES, will return SurePost specific rates (if available to your ShipTo destination).

But ...

SurePost is not normally available to low volume UPS shippers and probably wouldn't be available to new shippers (not until enough volume is determined by UPS). SurePost must be added to an existing UPS account, which is done by contacting UPS and filling out additional applications.

Hope that helps!

1
fanni On

Update 2021

It is interesting that SurePost is out of the list of service codes in the official docs. So the only info about the service code of this method is this topic. Thanks for that!

The mentioned 9x codes are working now. And yes, you need to switch from the Shop request option to the Rate to fetch rates for a needed code with additional Service block (example for the JSON API:

"Service": {
    "Code": "93",
    "Description": ""
}
1
Christine L Davis On

Jayesh Vaya's answer is correct, but here is further detail. There are 4 separate service codes for SurePost rates.

92: UPS SurePost Less than 1LB
93: UPS SurePost 1LB or greater
94: UPS SurePost BPM
95: UPS SurePost Media Mail

When shipping with service code 92, the unit of measure of the package weight must be in ounces instead of pounds, rounded to the tens decimal place. I found that the ounces unit of measure code was "OZS".

Note that your account with UPS must be enabled to ship with SurePost. The documentation for the SurePost Web Services API is available upon request from your UPS account executive. Here is the UPS documentation for using their API: Rating Service API

I hope this helps anyone who wasn't sure how to start, like I was yesterday! :)