开发者

Pre-filling first and last name in Paypal setExpressCheckout using ActiveMerchant

开发者 https://www.devze.com 2023-03-05 20:15 出处:网络
I\'m trying to get Paypal SetExpressCheckout operation to add first and last name for billing. I\'m using ActiveMerchant. I\'m seeing the address field pre-populated (street, state, city,zip-code) but

I'm trying to get Paypal SetExpressCheckout operation to add first and last name for billing. I'm using ActiveMerchant. I'm seeing the address field pre-populated (street, state, city,zip-code) but nothing else.

#### gateway ######
gateway = ActiveMerchant::Billing::PaypalExpressGateway.new(:login => 'login',:password     => 'pass',:signature => 'sig')  
### options ######
@options = Hash.new                 
@options.merge!(:ip => '127.0.0.1')
@options.merge!(:return_url => '127.0.0.1')
@options.merge!(:return_url => 'http://www.google.com')
@options.merge!(:cancel_return_url => 'http://www.google.com')
@options.merge!(:name => 'name')
@options.merge!(:description => 'description')
@options.merge!(:max_amount => 5000)
@options.merge!(:solution_type => 'Sole')
@options.merge!(:no_shipping => 1)
@options.merge!(:address_override => 1)
### build address
@address = Hash.new
@address.merge!(:name => "Joe User")
@address.merge!(:address1 => "111 ABCD EFG")
@address.merge!(:address2 => nil)           
@address.merge!(:city => "Fremont")
@address.merge!(:state => "CA")     
@address.merge!(:country => "US") 
@address.merge!(:phone => "408-111-2222")
@options.merge!(:address => @address)
setup_response = gateway.setup_purchase(5000, @options)
redirect_to gateway.redirect_url_for(setup_response.token)

On the resultant page, I开发者_开发问答'm not seeing the name pre-filled for billing. What am I doing wrong?

Thanks


I had the same issue as you did. After some research I came to the conclusion that this is a bug in ActiveMerchant. Please see the issue that I filed. It includes an explanation of how I patched my code to make phone number and names work:

https://github.com/Shopify/active_merchant/issues/161

0

精彩评论

暂无评论...
验证码 换一张
取 消