eml: contact@sevenforty.com tel: 1-866-620-7524 fax: 703-652-4788

the Blog Thoughts on code, design, information technology and company life.

USPS RateV2 Test Server Working XML Data

Sep 13, 2009 by

If you've ever had to develop an e-commerce application that performs postage rate calculations using the USPS Web Tools API, you've most likely come across the realization that the test server is broken - or appears to be broken. You've sent hundreds of XML messages only to have received just as many error response messages in return, despite knowing your XML is well-formed.

Fear not! The good news is that the server is not broken and your XML is most likely correct. The bad news is that the test server (as of this posting for V2 messages) appears to only accept one working message. The test server looks like it's online for one purpose only, which is to test your connection to the USPS servers and nothing more. Fortunately, once you've asked the kind folks at the USPS to switch you over to the production servers, you'll find your messages to be in working order. However, in order to do this, you'll need to perform three succesful connections.

Here now is a working XML message that we've used and have had success with for RateV2 messages to the test server. Sending this message should allow you to achieve the three successful test messages the USPS requires. Once done, you can ask them to switch you to the production servers.

  1. <?xml version="1.0"?>
  2. <RateV2Request USERID="your-user-id">
  3. <Package ID="0">
  4. <Service>PRIORITY</Service>
  5. <ZipOrigination>10022</ZipOrigination>
  6. <ZipDestination>20008</ZipDestination>
  7. <Pounds>10</Pounds>
  8. <Ounces>5</Ounces>
  9. <Container>Flat Rate Box</Container>
  10. <Size>REGULAR</Size>
  11. </Package>
  12. </RateV2Request>

* The order of the XML elements should also remain intact.


Leave a Comment

  1. Morgan Chiu wrote on Oct 02, 2010 11:59

    Thank you so much! I was pulling my hair trying to get a valid response. Who knew ONLY ONE SPECIFIC call would work. Why can’t USPS just include it in the welcome email?! Stupid…

  2. Upendra wrote on Oct 25, 2011 11:51

    Exactly what I was looking for. They STILL, as of Oct 2011, dont have support of V4 API on their test servers. Strange!

  3. Stephan wrote on Nov 04, 2011 13:18

    Yup, it’s not really a useful testing server. A bit pointless if you ask me.

  4. Daniele Graziani wrote on Mar 22, 2012 09:16

    Thank you! From the bottom of my heart, thank you. I had spent three days begging usps to throw me a bone and all they could do was tell me to refer to the documentation, which doesn’t tell you to use RateV2 for testing. I was stuck with the message: “Please enter a valid ZIP Code for the sender.” and I would get that no matter which valid zip code I passed.

  Note: You will be asked to PREVIEW your comment before posting.