Testing USPS Shipping with Magento

While doing final testing for DevoutGeek.com, I ran into a problem with the Shipping and Tax Estimator – it did not appear to work. When I entered the state and zip code, nothing was returned. I looked at the USPS shipping options in Magento’s admin – the values I entered seemed to be correct.

I looked at the Magneto’s shipping log (/var/log/shipping_usps.log) and found an authorization error:

        <Description>Authorization failure. You are not authorized to connect to this server.</Description> 

I went back into the Magento’s shipping options and reviewed the registration email that I received from the Post Office. I noticed that the test server url’s were not the same.

Magento Admin: http://production.shippingapis.com/ShippingAPI.dll
USPS Email: http://production.shippingapis.com/ShippingAPITest.dll

I changed Magento’s test server url to the one that I received from the post office, but I still did not receive a result from the Shipping Estimator. And I received a difference error in the shipping log.

        <Description>API Authorization failure. RateV4 is not a valid API name for this protocol.</Description> 

I began to search for another solution and I found that I should not have used the ShippingAPITest.dll url, so I changed it back to the original. I wanted to test the connection on the production server, not the test server, so I needed to contact the USPS Internet Customer Care Center to have them switch my profile to the production server.

The problem was that in order to have my profile switched to the production server, I needed to show that I had tested the connection on the test server. I added my userId to an XML test request that I found on the USPS.com.

          <Address2>6406 Ivy Lane</Address2>

I copy/pasted the url into my browser and received a response:

<?xml version="1.0"?>
<AddressValidateResponse><Address><Address2>6406 IVY LN</Address2><City>GREENBELT</City><State>MD</State><Zip5>20770</Zip5><Zip4>1440</Zip4></Address></AddressValidateResponse>

I then changed the address and tested again. Oddly enough, not all addresses return a valid address response. But, receiving any response validates the connection.

So I sent an email to the USPS Internet Customer Care Center to have my profile switched to production. Once it was switched, I updated Magento’s shipping options (turned debug option to “No” and changed the Mode option from “Development” to “Live”).

After the shipping options were updated, I added a t-shirt to my cart and tested the “Estimate Shipping and Tax” functionality. I was presented with USPS shipping options with estimated prices. Go Magento!

Be Sociable, Share!

Checkout My New Site - T-shirts For Geeks