Paypal Not Allowing Your Counrty Of Residence With Downloadable Products

This issue was solved with the help of a couple of our users who reported the error on their purchase and then continued to make test transactions for us from other locations in the world – Thank you! We really appreciate your help.

It’s been a big week completing the new template as well as the new shopping system. And for all our effort and testing we got rewarded with an unexpected Virtuemart Paypal error, Typical.

“Paypal does not allow your country of residence to ship to the country you wish to”

With much confusion and googling we discover we’re not the first to experience this error; And it’s not specific to Virtuemart. UberCart and other cart systems have also scored this error. test accounts don’t produce the same results so this error isn’t discovered until the shop goes live (we’ll for all our test accounts no errors were produced. Your cart and Paypal configuration may be different). Now I can’t help a whole bunch with other systems but I did find a work around for Joomla + Virtuemart.

In our Virtuemart admin area we can select ‘store’ then ‘list payments methods’, I have Paypal as my only active payment method. In the ‘configuration’ tab we get to set some parameters for pay pal like ourĀ  Paypal email. In the ‘extra info’ text area there is a bunch of PHP which pulls the users data and product info to be sent to Paypal for purchasing. It all looks dandy, until you configure Virtuemart for downloadable goods. Virtuemart 1.1.2 offers a nice revised check out to its earlier releases; We now get to skip all the billing and shipping info when we configure Virtuemart for downloads. This is good for the shopper which is always good for merchant. However in our first few lines of code in ‘extra info’ we’re still trying to pull the users ‘country code’.

Virtuemart's Paypal Payment Method

$db1 = new ps_DB();
$q = “SELECT country_2_code FROM #__vm_country WHERE country_3_code='”.$user->country.”‘ ORDER BY country_2_code ASC”;

With no billing or shipping info the Virtuemart user data goes to defaults in the database. Mainly a lot NULL’s a couple of 0’s and one ‘US’ which is the default country code in the database. Lucky for us it’s easy to fix. If you look further down the PHP extra info (around line 22) you’ll find a line with “address_override” => “1”,. This is some Paypal API to help the shopper with payment when they get to Paypal. With out all the data fields this causes error, but it’s OK we don’t want the address/billing info anyway.

To resolve:

Change line 22 “address_override” => “1”, to “address_override” => “0”,. With this set Paypal wont try and gather all the other address information which isn’t there.
And to save 0.004 of a second we can delete the database request on the first 3 lines or comment it out.
//$db1 = new ps_DB();
//$q = “SELECT country_2_code FROM #__vm_country WHERE country_3_code='”.$user->country.”‘ ORDER BY country_2_code ASC”;


 Add your comment
  1. I only changed the value from “1” to “0”.It is enough to skip the shiping error , or do i have to delete the first 3 lines as well.

    Thank you for this post…since i have the same problem.

  2. My colleague solved this one and he won’t be online for another 12 hours to confirm this but I believe the 3 lines of code can optionally be removed to increase efficiency.
    Try commenting them out so you can bring them back if it causes any issues.

  3. Thanks for this info. Worked just fine.
    Will this cause issues when I also have products that do ship out to people? At the moment they are all virtual, but that might change at some point.


  4. Hey there, just wanted to let everyone know that I tried commenting out the first three lines as suggested and I got a PHP joomla database error. I un-commented them restoring them to original and it worked like a charm. So if you comment them and it doesn’t work, try restoring them and setting the address line to “0” and it should work.


  5. Hello,

    Thank you for your tip!
    Indeed, you may receive a database error if you also remove the database query.

    To fix it, simply replace:
    “country” => $dbl->f(“country_2_code”),
    “country” => “”,

    ..found a little bit lower.

    Warm regards!

  6. Thanks for this.

    You have saved my life.

Leave a Comment

Your email address will not be published.