12

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?

1
  • 1
    I'd like to point out something more to others out there suffering with Paypal testing. I got it working after turning address_override off, but then I was stuck on 'Payment Review' status in paypal. Turns out you have to have same currency in Magento settings as you have in Paypal sandbox account. Otherwise paypal never fires IPN to complete the order.
    – ruuter
    Mar 7, 2013 at 6:50

3 Answers 3

7

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;
7

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?

2

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.

3
  • I'm surprised there is no better way doing this, not to mention the weirdness of this problem existing in Magento in first place. There should be option in back-end if such errors seem to be common for some time now. I guess I'll use the dirty local file approach, cause writing new module for it seems a bit too much for now:) i'll dig in deeper... tnx anyway!
    – ruuter
    Mar 6, 2013 at 2:56
  • I am no longer surprised by anything Magento does.
    – Krista K
    Mar 6, 2013 at 3:00
  • 1
    that does not sound promising :/
    – ruuter
    Mar 6, 2013 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.