Support the VirtueMart project and become a member

Main Menu

PayPal Payment Plugin sending wrong state format

Started by craigk292, May 14, 2013, 17:31:50 PM

Previous topic - Next topic


I am having a problem with how the PayPal Payment plugin is sending information to PayPal.  The attached file shows the PayPal page I am getting and shows the error.  Basically it says that the Shipping Address information is not correct.  I checked the information and it was absolutely correct so I called PayPal and spoke with there advanced support.  What he told me is that the state information is being sent in the wrong format....PayPal Plugin is sending the state as North Carolina but I'm told PayPal only accepts the acronym of NC.

Find below the email I was sent from Paypal Support.

Discussion Thread
Response Via Email (Bryce)   05/09/2013 09:46 AM

Hello Craig Kibbe,

My name is Bryce with PayPal Merchant Technical Services. I enjoyed speaking with you and hope you found our conversation helpful.

I tested your site the primary issue is the "state" is being passed as the name instead of the 2 digit abbreviation.

Since your cart is including the command "address_override=1" the buyer is unable to change the address on our site to correct it themselves.

Changing either the way the state is passed...PREFERRED or giving the buyer the ability to change the address would resolve the problem although I'd suggest at least changing "state" as it would be the better buyer experience.

To update this ticket, simply reply to this email or go to and click the “My Stuff” tab. To login, please enter your email address and password in the Returning Users area. The default password is your email address.

This ticket will remain pending for the next 7 days, if you have no further questions regarding this matter please reply and I will close this ticket.

Merchant Technical Services
PayPal, an eBay company

Anyone know how I can fix this problem?? :o

Here is my site information:

*  Joomla 2.5.11
*  Jomsocial 2.8.3
*  AEC 1.2RC Revision 5942
*  Virtumart 2.0.20

Those are the primary Extensions.

[attachment cleanup by admin]


Are you in production server ?
Did you already encounter  these kind of  issue ?

So, in Payment Methods, in your paypal payment, in Configuration tab, you have a parameter called "Let buyers override their PayPal addresses?" set to No by defaut.

Try to turn on Yes and retry with this particular adresse or an other

Help this help you

Best regards



I'd already checked the Override and it is set the Yes.  It has been set to that way for several weeks.  This is not the problem.  More importantly, the proper setup would send NC to PayPal instead of North Carolina.  That is the proper way for the system to send the state information to PayPal.



Sometimes you might try reinstalling the plugin.
What type of server on you on? Godaddy?
Is this a shared server or your own server?

Have you checked system information and made sure everything is writeable?


The problem does not seem to be with the processing, but more to do with the data being sent.  Reinstalling the plugin would not correct the problem.  The State is being supplied from the Db.  The only way to correct this would simply be to change the table from the state's full name to abbreviated name... NC.  How can we make that happen?


Why would you be the only one that this happens to and not so many others? There is something wrong with your configuration somewhere or we would all be going through this.
I would install and run Admin tools just for the heck of it.

It just seems like someone changed some settings (as by default the plugin sends the correct address type) or made some core hacks. Has anything out of the norm been changed on your site since installation?



QuoteI tested your site the primary issue is the "state" is being passed as the name instead of the 2 digit abbreviation.
Yes you are rigth

The fix is the following
replace line 209
"state"            => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID ($address->virtuemart_state_id ) : '',
"state"            => isset($address->virtuemart_state_id) ? ShopFunctions::getStateByID ($address->virtuemart_state_id, 'state_2_code') : '',

i am fixing it for the next version



That fixed it!!!!  You are my hero now!  That was a simple fix for a BIG PROBLEM! 

Thanks so much.  We can mark this one SOLVED!  :D




Thank you both for posting this and providing a patch!


I too have this problem. In VM  2.0.20b, what file specifically did you alter that code?
I'm holding off updating to the latest VM version b/c I am having conflicts with the new version.
Thank you in advance!


If you are using the 2.0.20b it is in the file plugins/vmpayment/paypal/paypal.php