A path toward getting all the USPS shipping options, with ONE copy/paste

JamesNewton
Contributor
Contributor

 

The more I look at and use the USPS.com "Click & Ship" site, the more I like it. Every option is there, and it shows you what each service costs, if it is trackable and so on. Several times now, I've found that I could get a faster/better service for just a few cents more than what would be an option at PayPal. And it was through the USPS site that I learned the envelope AND small flat rate box are NOT trackable when using Priority Mail international. It also offers the small flat rate box for domestic shipment at the correct price, so you don't have to over pay for it as you must with PayPal.

 

The only problem with using it is the time it takes to copy and paste each part of the buyers address from PayPal to USPS. All that switching back and forth between paypal and usps, selecting each part of the address, copying and pasting it... it becomes very annoying. But we are using computers, and computers are made to automate things for us.

 

There is a type of a program called a "BookMarklet" which is written in JavaScript and can be installed in your browsers bookmark bar.

http://en.wikipedia.org/wiki/Bookmarklet

Bookmarklets can be used to automate all sorts of tasks; there are BookMarklets to do all sorts of things: Count the number of words in a selection on a web page, google a word you select on a web page, etc... I wrote one some time ago that uses the internet archive project to show what a web site USED to look like when it has been changed or if it is no longer on the net:

http://massmind.org/techref/wayback.htm 

 

Why am I rambling on about this? Because I think it should be possible to write a BookMarklet that would accept a buyers name and address in a block, the way paypal gives it to us, separate it into it's parts (name, street, city state zip) and then paste that into the form on the USPS "Click & Ship" page. This would reduce the effort of using "Click & Ship" down to just copying the buyer address from PayPal, opening the "Click & Ship" page, clicking the bookmarklet, pasting in the address, confirming that the bookmarklet separated it correctly into the "Click & Ship" page, and then purchasing/printing the shipping label. 

 

Frankly, It's probably beyond my ability to do it, and I don't really have the time at this point, but some of these other guys who write BookMarklets might be willing to help us if we asked nicely or paid for the work.


 

Login to Me Too
1 REPLY 1

JamesNewton
Contributor
Contributor

The google geocoding API or HTTP request could greatly simplify the programming required to break the address paypal gives us into its parts so they can be plugged into the USPS web site.

 

http://code.google.com/apis/maps/documentation/geocoding/index.html explains that if you just take the address (you can even leave the customer name on the front) and send it after the "=" to :

http://maps.google.com/maps/geo?output=xml&q= 

you get back an xml response with the address separated out into its parts (in addition to the lat and log which we wouldn't use). For example:

http://maps.google.com/maps/geo?output=xml&q=Mr.+John+Google,+1600+Amphitheatre+Pkwy,+Mountain+View,...

returns text that could be parsed into a variable called "place" and then:

 

 

var streetAddress = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName;
var city = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.SubAdministrativeAreaName;
var state = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
var zip = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber;

Which is verbose, but effective. It might require more code than a bookmarklet can have... 

 

Finally, those var's would be set into the field values on the USPS.com form.

 

The customers name would still need to be parsed out... 

 

Any JavaScript / bookmarklet programmers out there want to finish this up?

 

See also: 

http://www.developer.com/lang/jscript/article.php/3615681/Introducing-Googles-Geocoding-Service.htm


 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.