Paypal address problems with active_merchant

Hi. New to rails and active_merchant. I’m currently testing my
shopping cart with paypal sandbox and it’s kind of working but not
quite.

Besides the credit card stuff, I’m also filling most parameters for
buyer information.

However, I am getting a bad response from paypal saying:

“There’s an error with this transaction. Please enter a complete
shipping address.”

I’ve dumped the buyer information I am passing to the gateway
authorize function, which when the error occurs would be equivalent to
this:

… snip … money and creditcard

gateway = ActiveMerchant::Billing::PaypalGateway.new(
:login =>
PAYPAL_LOGIN,
:password =>
PAYPAL_PASS
)

buyer = {
:email=>“[email protected]”,
:address=>{:phone=>“4943-2134”,
:address1=>“Main Ave. 414”,
:address2=>"",
:city=>“Fresno”,
:state=>“California”,
:country=>“US”,
:zip=>“90063”},
:description=>“Software”,
:order_id=>4,
:ip=>“201.243.52.221”
}

response = gateway.authorize( money, creditcard, buyer )

and quite frankly, I cannot see anything wrong other than an obvious
fake address. I’ve also tried sending two letter states and full
country names with no improvement.

Does anyone have any idea what to try? The paypal error response is
anything but useful. I’ve looked into the active_merchant paypal
gateway and the address gets copied to shipping address using some
weird xml keys, so not sure what paypal complains about. I was unable
to find docs about the paypal xml that active merchant uses.