Magento – Paypal shipping address errors

checkoutpaymentpayment-gatewaypaypal

I'm trying to test my shop with PayPal Sandbox.
I get 2 different errors in 2 different situations.
1. All works fine till finishing order in PayPal.
Then get message:

We're sorry, PayPal doesn't allow residents of United States to ship purchases to (anywhere)

2. second situation is when I then change my buyer shipping address to US. I get following error, on first page in paypal:

Unable to process payment. Please contact the merchant as the shipping address provided by the merchant is invalid, and the merchant has requested that your order must be shipped to that address.

I found out form here, that this seems to be problem for many. From here I found out that there is something to do with address_override method and here is suggested to turn it off.
Is there a way to turn it off in Magento? Is it safe to turn it off? Why is it there in a first place? or what other solutions are out there? :

I found address_override method in magento at

\app\code\core\Mage\Paypal\Model\Api\Standard.php line:238
$request['address_override'] = 1;

Changed it to '0' and now paypal sandbox works. No errors anymore. But how can I do this without changing magento core files ? and is it safe?

Best Answer

You can do the following if you don't want to change core files:

  1. Create folders Mage/Paypal/Model/Api under /app/code/local/
  2. Copy the file Standard.php from /app/code/core/Mage/Paypal/Model/Api
  3. Paste the file Standard.php to /app/code/local/Mage/Paypal/Model/Api
  4. Change the line 238 from
$request['address_override'] = 1;

to

$request['address_override'] = 0;
Related Topic