UPS Shipping method tutorial in php and javascript


This is a UPS Shipping method tutorial which is very help to get cost of goods ‘s weight from UPS.You can also customize this code very easily in php and other language.

 

UPS Shipping

Use This URL and XML code to get UPS Shipping Charges:

URL: https://www.ups.com/ups.app/xml/Rate

<?xml version=’1.0′ ?>

<AccessRequest xml:lang=’en-US’>

<AccessLicenseNumber>9999999999999999</AccessLicenseNumber>

<UserId>MyUserID</UserId>

<Password>MyPassword</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>44129</PostalCode>

<CountryCode>US</CountryCode>

</Address>

</Shipper>

<ShipTo>

<Address>

<PostalCode>44129</PostalCode>

<CountryCode>US</CountryCode>

</Address>

</ShipTo>

<ShipFrom>

<Address>

<PostalCode>32779</PostalCode>

<CountryCode>US</CountryCode>

</Address>

</ShipFrom>

<Service>

<Code>01</Code>

</Service>

<Package>

<PackagingType>

<Code>02</Code>

</PackagingType>

<Dimensions>

<UnitOfMeasurement>

<Code>IN</Code>

</UnitOfMeasurement>

<Length>20</Length>

<Width>20</Width>

<Height>20</Height>

</Dimensions>

<PackageWeight>

<UnitOfMeasurement>

<Code>LBS</Code>

</UnitOfMeasurement>

<Weight>23</Weight>

</PackageWeight>

</Package>

</Shipment>

</RatingServiceSelectionRequest>

This URL and query String Get UPS Shipping Charges:

URL: http://www.ups.com/using/services/rave/qcostcgi.cgi?

Query String Variable:

1) accept_UPS_license_agreement=yes

2) 10_action ( two option (1)3 for single service (2)4 for all service)

3) 13_product (there are many options)

  • Next Day Air Early AM – 1DM
  • Next Day Air – 1DA
  • Next Day Air Saver – 1DP
  • 2nd Day Air – 2DA
  • 3 Day Select – 3DS
  • Ground -GND

4) 14_origCountry = (Ex: US, short form)

5) 15_origPostal = (Ex: 90405)

6) 19_destPostal = (Ex: 90007)

7) 22_destCountry = (Ex: US, short form)

8) 23_weight = (Product’s Weight)

9) 47_rate_chart = (There is diff options)

  • Regular Daily Pickup
  • On Call Air
  • One Time Pickup
  • Letter

10) 48_container = (Package type of product)

  • 00 – Your Packaging
  • 01 – UPS Packaging,
  • and other two one is 21, and ..

11) 49_residential = (1 – for Residential address, 0 – commercial address)

Example string  : http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=1DM&14_origCountry=US&15_origPostal=90405&19_destPostal=90007&22_destCountry=US&23_weight=24&47_rate_chart=On+Call+Air&48_container=21&49_residential=1

http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=GND&14_origCountry=US&15_origPostal=30071&19_destPostal=94549&22_destCountry=US&23_weight=.10&47_rate_chart= Regular+Daily+Pickup&48_container=00&49_residential=1

http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=GND&14_origCountry=US&15_origPostal=30071&19_destPostal=90401&22_destCountry=US&23_weight=.50&47_rate_chart=%20Regular+Daily+Pickup&48_container=00&49_residential=1

http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=GND&14_origCountry=US&15_origPostal=30071&19_destPostal=90401&22_destCountry=US&23_weight=0.5&47_rate_chart=Regular+Daily+Pickup&48_container=00&49_residential=1

http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=GND&14_origCountry=US&15_origPostal=30071&19_destPostal=19943&22_destCountry=US&23_weight=5.72&47_rate_chart=%20Regular+Daily+Pickup&48_container=00&49_residential=1

http://www.ups.com/using/services/rave/qcostcgi.cgi?accept_UPS_license_agreement=yes&10_action=3&13_product=GND&14_origCountry=US&15_origPostal=30071&19_destPostal=19943&22_destCountry=US&23_weight=5.72&47_rate_chart=Regular+Daily+Pickup&48_container=00&49_residential=1

One thought on “UPS Shipping method tutorial in php and javascript

Leave a comment