Paypal Adaptive payments?
I am using PayPal Adaptive Payments in a rails 3 application. I'm wondering if this the best approach or if there's better way to use PayPal Adaptive Payments?
=> Install Active merchant plugin latest version
https://github.com/sijokg/active_merchant(https://github.com/sijokg/active_merchant.git)
=> Create a Object for paypal adaptive gateway
gateway = ActiveMerchant::Billing::PaypalAdaptivePaymentGateway.new( :login => "divya_xxxxxx_biz_api1.yahoo.com",:password => "XXXXXXXX", :signature => "XXXXXXXXXXXXXXXXXXXX",:appl_id => "APP-80W284485P519543T" )
ss= gateway.pay params[:donor][:amount].to_i , 'foobar@yahoo.com', :ip => request.remote_ip,
:sender_email => "foobar@yahoo.com",
:tracking_id => tracking_id,
:pay_key => '24',
:return_url =>"http://myapp.heroku.com, :cancel_url=>
"http://foofoo.heroku.com , :ipn_notification_url => "http://foofoo.heroku.com/paypal_ipn"
=> It returns paykey , using this paykey I redirect to below urls based on requiremnet
redirect_to "https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=#{ ss.params['pay_key']}"
redirect_to "https://www.paypal.com/webscr?cmd=_ap开发者_运维技巧-payment&paykey=#{ ss.params['pay_key']}"
=> It goes to paypal site and compelte transaction with email or visa card and return .
=> If I use sandbox account , It needs to login in sandbox account
=> It send " Paypal Ipn " to my site .
=> Tranaction complete .
* This process takes much time because it is two steps process . If it is not correct, pelase suggest any alternative solution with paypal adaptive payments .
I use https://github.com/tc/paypal_adaptive and it's working great for me. Yes, it's a 2 step process. You need to get the payKey from PayPal then either 1) redirect the user or 2) kick of the lightbox flow with PAYPAL.apps.DGFlow, specified here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_APCommands
精彩评论