문제

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?

도움이 되었습니까?

해결책

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;

다른 팁

The address_override parameter is there to set the shipping address your Magento shop is sending to Paypal as shipping address instead of the customer's shipping address saved at Paypal's side.

If address_override is set to 1, which is the case in Magento, then Paypal will validate the shipping address. If the parameter is set to 0, it supposedly doesn't. So make sure you're sending a valid and well-formatted address to Paypal.

I ran into this problem because of a missing "state" value. Paypal only accepts state abbreviations like "CA" for "California". For other countries, states might not be available in your Magento installation by default, e.g. for Mexico.

Did you customize any shipping address fields in your checkout?

Check out these Stack Overflow answers:
https://stackoverflow.com/questions/5978153
https://stackoverflow.com/questions/11281543

Basically, a quick and dirty way is to copy the entire file to your app/code/local/Mage world, but would be even better for upgrades if you could overload just the one lone function.

Also, if not already, please use Github for version control. It has saved me more than once! You can track all changes easily, even if you are being bad and editing core files.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top