Jump to content
fulluvscents

USPS Rate V4, Intl Rate V2 (official support thread)

Recommended Posts

Thanks for the reply - and the work you've done here.

 

I don't know how different this one is from the 'methods v7.3.1' but the extra services in that module work.  I dont know if the international rate prices are right, but I know it just errors on domestic addresses.  Since that one doesn't give "N/S/H," I wondered if there might be a problem with the checkbox fields in V4_V2.

 

Might be a temporary fix, to use 7.3.1 for international with insurance, and use V4 intl rate v2 for domestic, as we dont offer insurance on domestic.  But if both modules are named USPS, is there a "right" way to change the name of one of them?

 

I tried unsuccessfully to clone V4_V2 (usps.php and usps_48.php) once before.  Selections came up right, but it looped back to checkout_shipping.php when I tried to move on to checkout_payment.php.  So I don't know what I missed.

 

I'll keep digging.  I look forward to the new module you're developing.

Share this post


Link to post
Share on other sites

You have to change more than just the name of the file. There's a brief description of the changes in this forum post. That's talking about the information box, but all other modules are similar.

 

I need to get that new module finished. At least that one is named differently, so no conflicts if you want to run it with another USPS module.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

With an invalid Postal Code, the USPS will return a response something like this:
 

Response:
<?xml version="1.0" encoding="UTF-8"?>
<RateV4Response>
  <PackageID="0">
    <Error>
      <Number>-2147219497</Number>
      <Source>RateEngineV4;RateV4.ProcessRequest</Source>
      <Description>Please enter a valid ZIP Code for the recipient.</Description>
      <HelpFile/>
      <HelpContext/>
    </Error>
  </Package>
  <PackageID="1">
    <Error>
      <Number>-2147219497</Number>
      <Source>RateEngineV4;RateV4.ProcessRequest</Source>
      <Description>Please enter a valid ZIP Code for the recipient.</Description>
      <HelpFile/>
      <HelpContext/>
    </Error>
  </Package>
  <PackageID="2">
    <Error>
      <Number>-2147219497</Number>
      <Source>RateEngineV4;RateV4.ProcessRequest</Source>
      <Description>Please enter a valid ZIP Code for the recipient.</Description>
      <HelpFile/>
      <HelpContext/>
    </Error>
  </Package>
</RateV4Response>

And the response for a valid ZIP code begins like this:

Response:
<?xml version="1.0" encoding="UTF-8"?>
<RateV4Response>
  <PackageID="0">
    <Error>
      <Number>-2147219385</Number>
      <Source>DomPostageLibrary;RateV4.ProcessRequest</Source>
      <Description>The requested Mail Service is not available for the specified request attributes.</Description>
      <HelpFile/>
      <HelpContext/>
    </Error>
  </Package>
  <PackageID="1">
    <ZipOrigination>95112</ZipOrigination>
    <ZipDestination>95112</ZipDestination>
    <Pounds>2</Pounds>
    <Ounces>3.68</Ounces>
    <Container>VARIABLE</Container>
    <Size>REGULAR</Size>
    <Zone>1</Zone>
    <PostageCLASSID="1">
      <MailService>Priority Mail1-Day&lt;sup&gt;&#8482;&lt;/sup&gt;</MailService>
      <Rate>6.70</Rate>
      <CommercialRate>5.49</CommercialRate>
      <SpecialServices>
        <SpecialService>
          <ServiceID>19</ServiceID>
          <ServiceName>AdultSignatureRequired</ServiceName>
          <Available>true</Available>
          <AvailableOnline>true</AvailableOnline>
          <Price>5.20</Price>
          <PriceOnline>5.20</PriceOnline>
        </SpecialService>
        <SpecialService>
          <ServiceID>20</ServiceID>
          <ServiceName>AdultSignature RestrictedDelivery</ServiceName>
          <Available>true</Available>
          <AvailableOnline>true</AvailableOnline>
          <Price>5.45</Price>
          <PriceOnline>5.45</PriceOnline>
        </SpecialService>
        <SpecialService>
          <ServiceID>9</ServiceID>
          <ServiceName>Certificateof Mailing (Form3817)</ServiceName>
          <Available>true</Available>
          <AvailableOnline>true</AvailableOnline>
          <Price>1.30</Price>
          <PriceOnline>1.30</PriceOnline>
         </SpecialService>

(etc.)

So, while a valid ZIP code may return one error (-2147219385), an in-valid ZIP code will return three errors, all with the same error number (-2147219497).

 

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

That's the problem. I don't think that counting the number of errors is valid, as it's just returning an error for each service requested. If you only had one valid service requested you would only get one error message.

 

You could probably use the error number to get only the invalid zip code error message, but there could also be other valid errors. Maybe check to see if there are any valid quotes and only show the error message if there are none. This needs a lot of testing. Unfortunately I don't have the time right now to do all of this.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I get no USPS response for shipping to a Slovakia address.  USPS.com says $6.55 for a 4 oz package, First Class International.  I get First Class International shipping for several other countries tested on my oscommerce store.  Checking the user account address book, Slovakia is in the drop-down list.

 

Any ideas why this doesn't work?

Share this post


Link to post
Share on other sites

@@TomB01  What USPS services are enabled? What are your Tare weight settings?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

@@TomB01  What USPS services are enabled? What are your Tare weight settings?

 

Regards

Jim

I enable:

1st Class Package Domestic and International

Priority Mail Domestic and International

Priority Express Mail Domestic and International

 

Package Tare Weight is 0.125

Edited by TomB01

Share this post


Link to post
Share on other sites

Check that Slovakia is spelled correctly in your database and that the correct abbreviations are also there. These must match the USPS usage exactly.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Check that Slovakia is spelled correctly in your database and that the correct abbreviations are also there. These must match the USPS usage exactly.

 

Regards

Jim

The "countries" table says,

 

"Slovakia (Slovak Republic)","SK","SVK" for countries_name, countries_iso_code_2, countries_iso_code_3.

 

??

Share this post


Link to post
Share on other sites

Change that to Slovak Republic (Slovakia) and try again.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Change that to Slovak Republic (Slovakia) and try again.

 

Regards

Jim

WORKED! :D 

Share this post


Link to post
Share on other sites

That made it match the current USPS usage. I'm just waiting for them to start making changes that will cause UPS or FedEx to fail for that country.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Understood ... from my perspective, though, it seems amazing that it works so often for so many instances as it is.

 

Regardless, many, many thanks, Jim.  That was quick, specific, and led to an immediate resolution.  Absolutely great on your part!!

Share this post


Link to post
Share on other sites

I just installed this on OSC v2.2 RC2. Yes, I uninstalled old module first. Yes, I have and even registered for a new USPS ID. I'm not getting any response in the debug email (contents below from email).

 

Request:
API=RateV4&XML=<RateV4Request USERID="6***2"><Revision>2</Revision><Package
ID="0"><Service>STANDARD
POST</Service><ZipOrigination>34667</ZipOrigination><ZipDestination>34654</ZipDestination><Pounds>2</Pounds><Ounces>0</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Machinable>TRUE</Machinable></Package><Package
ID="1"><Service>PRIORITY
COMMERCIAL</Service><ZipOrigination>34667</ZipOrigination><ZipDestination>34654</ZipDestination><Pounds>2</Pounds><Ounces>0</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Machinable>TRUE</Machinable></Package><Package
ID="2"><Service>EXPRESS
COMMERCIAL</Service><ZipOrigination>34667</ZipOrigination><ZipDestination>34654</ZipDestination><Pounds>2</Pounds><Ounces>0</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Machinable>TRUE</Machinable></Package></RateV4Request>

Response:


Errors:
 

Edited by WhoFlungPoo

Share this post


Link to post
Share on other sites

That looks correct. Have you verified with USPS that you are authorized to use the production server?

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Yes, I used my old ID which I've had forever and the new one. In the email sent with the new ID it now says:

 

You have been granted standard production access including the below API functionality. Please note that you no longer need to contact the USPS for access to these services:
        Price Calculators
        Package Tracking
        Service Standards and Commitments

 

I believe I found the issue though. In the file /includes/modules/shipping/usps.php under function usps() the last conditional is...

 

if ( MODULE_SHIPPING_USPS_SERVER != '' ) {
        $this->usps_server = MODULE_SHIPPING_USPS_SERVER;
      }

 

This line was resetting the usps_server to 'production' from the database so the URL was resolving to

http://production//shippingapi.dll?API=RateV4&XML=%3CRateV4Request+USERID%3D%22372XXX7%22%3E%3CPackage+ID%3D%220%22%3E%3CService%3EPRIORITY+MAIL%3C%2FService%3E%3CZipOrigination%3E34667%3C%2FZipOrigination%3E%3CZipDestination%3E34654%3C%2FZipDestination%3E%3CPounds%3E2%3C%2FPounds%3E%3COunces%3E0%3C%2FOunces%3E%3CContainer%3EVariable%3C%2FContainer%3E%3CSize%3ERegular%3C%2FSize%3E%3CMachinable%3Etrue%3C%2FMachinable%3E%3C%2FPackage%3E%3C%2FRateV4Request%3E

 

Once I removed this line it works fine. Not sure if this is the correct fix though. Any insight?
 

Share this post


Link to post
Share on other sites

You do not need to remove any lines of code. The default setting for USPS Server in the module setup is blank. I have no idea how you got any other value in there. Remove whatever is there and the module should work as expected.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

We can ship anywhere in the world by USPS, except for Greece.

 

Here's what's in the countries table:

84 Greece GR GRC

1

 

A couple of questions:

 

1. Is there an official list somewhere that I can use to validate this entry?

 

2. Is there a way to validate the entire country table or is there an updated table to replace the one I have?

 

3. Absent the above, do you see anything wrong with the entry for Greece listed above?

 

Thanks for all your help.

Share this post


Link to post
Share on other sites

1. Ask the USPS for their country list.

 

2. Not that I know of.

 

3. No, that matches the country name on the USPS site, so it should work.

 

I suggest that you turn on Debug in the module and run a test order to Greece. The response from USPS may give a hint.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I found the problem, but not the solution... It has nothing to do with Greece.

 

We ship everything priority mail.

 

When a larger box is required for the shipment, it returns the correct pricing.

 

When a small flat rate box is required, it returns the correct pricing from the USPS server, BUT!!! Then, OSCommerce is not recognizing it and displaying it.

 

It works correctly for domestic, but not for international.

 

So, it appears that there's been a service name change or something for international priority mail flat rate small boxes.

 

I'm not sure exactly how the mechanism works. It appears that the USPS returns all options and then OSCommerce filters what to display based on the settings for the module in the OSCommerce control panel.

 

Has there been an update recently to service names or something that would break this? It was working and now it's not.

Share this post


Link to post
Share on other sites

Are you using the latest version of the module? The USPS changes their interface all the time, so it's possible that they have changed something after that. I wouldn't know unless they posted changes, and I don't see anything after the September 7th release.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

I updated to the current version and that fixed the problem.

 

Thank you.

 

Now, I have a question for you:

 

We are signed up with the Post Office to receive email notifications when they make changes to their API, etc. - BUT we NEVER get those emails, so we're left scrambling when something breaks. Worse yet, this only affected small overseas orders, so we didn't even know there was a problem until a customer complained about the shipping (UPS to Greece is very expensive.)

 

Does anyone else have problems getting the updates from the Post Office? 

 

What do you do to keep up with it? Is there a webpage at USPS.com we can monitor?

 

I only have one customer left on OSCommerce and this i\really is driving us nuts. (The other shopping carts we use have automated module updates, so when we see a shipping module update, we make sure that gets applied immediately.)

Share this post


Link to post
Share on other sites

I'm also signed up with the USPS, and I have only received a notice once. Their customer support is truly terrible.
 
You can check the above page every month or so. I won't guarantee that they will announce changes on that page, or the page itself won't be moved or just deleted, but it's a start. Also, they claim that changes are made only in March and September. That was not the case this year, but changes tend to cluster around those months, so again something to look out for.
 
I really need to get back to work on writing a new module. There are ways to make the USPS changes easier to handle, and I've got a good start on that. I just need to do the last 20% or so of the work. If I can only find the time.
 
Regards
Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Hi just installed usps mod and installed but it does not show on the check out page help needed

 

Thanks in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×