Paypal 自适应支付?
我在 Rails 3 应用程序中使用 PayPal 自适应支付。我想知道这是否是最好的方法,或者是否有更好的方法来使用 PayPal 自适应付款?
=>安装Active商家插件最新版本
https://github.com/sijokg/active_merchant(https://github.com/sijokg/active_merchant.git)
=>为 paypal 自适应网关创建一个对象
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 , '[email protected]', :ip => request.remote_ip,
:sender_email => "[email protected]",
: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”
=>它返回 paykey ,使用此 paykey 我根据 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']}"
=> 重定向到以下网址它进入贝宝网站并使用电子邮件或维萨卡完成交易并返回。
=>如果我使用沙箱账户,则需要登录沙箱账户
=>它将“Paypal Ipn”发送到我的网站。
=>交易完成。
*这个过程需要很多时间,因为它是两个步骤的过程。如果不正确,请建议使用 paypal 自适应支付的任何替代解决方案。
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 , '[email protected]', :ip => request.remote_ip,
:sender_email => "[email protected]",
: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 .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 https://github.com/tc/paypal_adaptive 它对我来说非常有用。是的,这是一个两步过程。您需要从 PayPal 获取 payKey,然后 1) 重定向用户或 2) 使用 PAYPAL.apps.DGFlow 启动灯箱流程,此处指定:https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_APCommands
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