How to set up Magento with USPS shipping methods and get permission to use the USPS production API
- by Asher Bond
2011 Fresh update:
Many people don’t know the news… You can now subscribe to a low-cost, PCI and DSS compliant, managed version of Magento in the Cloud. It’s called Magento Go (formerly Magento Stratus when it was only a nascent release candidate). Along with this new Magento offering, Varien (Magento’s open-core contributor company) has announced a startup-friendly economic stimulus package (which is a freemium trial with no setup fees and deferred monthly recurring costs) to help you build e-commerce business momentum with little technical effort.
For those of you who are e-commerce systems integrators who like to get down into the nuts and bolts and those of you who just like to take e-commerce in-house… you may be getting the following error message when trying to integrate USPS shipping calculations:
United States Postal Service:
This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.
The error is generally caused by one of these four issues:
- USPS hasn’t moved your new (test only) Webtools account into production.
- You didn’t specify the weight metrics for your product(s).
- You didn’t put in the correct web tools ID as your shipping methods user ID (should look like 123MYMAG4567 … or 6 dots when it’s saved)
- You forgot to put the http:// in your gateway URL (under shipping methods).
Magento, by default comes with the following URL set up in the shipping configuration for USPS:
http://production.shippingapis.com/ShippingAPI.dll
If you put in the weight for each of your products and you are specifying the right production gateway (http://production.shippingapis.com/ShippingAPI.dll), then it’s likely that you don’t have access to USPS’s production API. USPS doesn’t give you access to the production API by default, but rather… they give you access to the test API which only supports one specific address. USPS needs to approve your account before they will give you access to the production USPS API. Once they transition your account into production, Magento should start working. Keep in mind that they only allow you to use it on one web site per account, so if you’re setting Magento up for a client, customer, or other business entity other than your own you should set up a separate USPS account for them.
If you don’t have a USPS API (WebTools) account, you can set up your USPS WebTools account here:
http://www.usps.com/webtools/
Once you have set up your account, they will give you access to the testing environment. The URL for the USPS test API is:
http://testing.shippingapis.com/ShippingAPITest.dll
Now, before you paste that into Magento, you should be aware that the USPS test environment only supports very specific data. According to their own documentation:
ZipOrigination: 10022
ZipDestination: 20008 (is set during Checkout process by user)
Pounds: 10
Ounces: 5 (weight can be set for every product on Administration > Products)
Size: LARGE
Machinable: TRUETo test international shipping use the following values:
Pounds: 2
Ounces: 0
MailType: Package
Country: Albaniaor
Pounds: 0
Ounces: 1
MailType: Postcards or Aerogrammes
Country: AlgeriaAll other parameters’ values won’t work in the test environment.
This is why most Magento consultants and installation service providers typically just ask USPS to turn on production mode. When you are approved by USPS for the production API, you should use the following URL:
http://production.shippingapis.com/ShippingAPI.dll
But remember, it’s very important that you set up a separate USPS account for each Magento web site (or at least one per domain). USPS will disable your access to their production server if you are caught using your account on multiple web sites. That would make all of your Magento customers very upset, all at the same time.
To request access to the USPS production API, fill out the form here:
http://www.usps.com/webtools/webtoolsapirequestform.htm
Be sure that in your request, you explain that you are using third party software (Magento) and that you only want access to the API so that you can calculate shipping costs associated with using USPS.
If you leave out this information they will reject your request or ask you to submit a valid test before they give you access. Third party software doesn’t need to be tested as long as you tell them you are using Magento.
USPS doesn’t allow you to use their API for batch processing or data cleansing, so be sure to NOT check these boxes on the request form.
Once USPS gives you access to their production API server, Magento should work with all USPS shipping options. If you are still having trouble, check that you have access to USPS’s production API server.
USPS Tech Support: 1-800-344-7779 (7:00 AM to 11:00 PM EST daily)
Once you have it correctly configured and you have access to the production API, you should be able to place an order and check out to see a list of USPS shipping options with the costs of each calcualted based on the weight of the product you are ordering.
You will need to remove shipping options that are irrelevant, for example USPS Library Mail is only for shipping academic things like books between academic institutions or libraries.
Click here to read about different shipping methods such as Parcel Post.
Click here to download premium themes for Magento, Joomla, WordPress, Drupal, PHPBB, etc.





















