使用ActiveMerchant自定义Paypal Express的评论页面 [英] Customizing Paypal Express's Review Page using ActiveMerchant

查看:52
本文介绍了使用ActiveMerchant自定义Paypal Express的评论页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ActiveMerchant使我的rails应用程序可以访问Paypal的Express Checkout. 我想按如下所述在查看"页面上包括订单详细信息": https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing

I am using ActiveMerchant to give my rails app access to Paypal's Express Checkout. I would like to include the Order Details on the Review Page as described here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing

可以做到吗?

当前,我的控制器代码如下:

Currently, my controller code looks like this:

def paypal
  #currently, options is unused, I'm not sure where to send this info
  options = { 
              :L_NAME0=>"Tickets", 
              :L_QTY0=>@payment.quantity, 
              :L_DESC0=>"Tickets for #{@payment.event_name}",
              :L_AMT0=>@payment.unit_price
            }

  #the actual code that gets used
  setup_response = gateway.setup_purchase(@payment.amount,
    :ip=> request.remote_ip,
    :return_url=> url_for(:action=>:confirm, :id=>@payment.id, :only_path=>false),
    :cancel_return_url => url_for(:action=>:show, :id=>@payment.id, :only_path=>false)
  )
  redirect_to gateway.redirect_url_for(setup_response.token)
end

如果我想做的事情是可能的,我需要更改什么?

If what I'm trying to do is possible, what do I need to change?

推荐答案

@Soleone 我尝试了您的解决方案,但对我不起作用.

@Soleone I try your solution,but don't work for me.

xml.tag! 'n2:OrderDescription', options[:description]
xml.tag! 'n2:Name', options[:name]
xml.tag! 'n2:Description', options[:desc]
xml.tag! 'n2:Amount', options[:amount]
xml.tag! 'n2:Quantity', options[:quantity]

我认为xml结构不正确,订单项是多个,所以应该这样

I think the xml structure is not right,the order items is multiple,so should like this

xml.tag! 'n2:OrderItems' do
    xml.tag! 'n2:OrderItem' do
        xml.tag! 'n2:Name', options[:name]
        xml.tag! 'n2:Description', options[:desc]
        xml.tag! 'n2:Amount', options[:amount]
        xml.tag! 'n2:Quantity', options[:quantity]
    end
end

但是我现在真的不知道正确的结构.

But really I don't know the correct structure,looking for now.

====更新

我找到了SOAP api文档,

I found the SOAP api doc, https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_soap_r_SetExpressCheckout#id09BHC0QF07Q

xml.tag! 'n2:PaymentDetails' do
    xml.tag! 'n2:PaymentDetailsItem' do
        xml.tag! 'n2:Name', options[:name]
        xml.tag! 'n2:Description', options[:desc]
        xml.tag! 'n2:Amount', options[:amount]
        xml.tag! 'n2:Quantity', options[:quantity]
    end
end

但是也没有用,谁能帮忙?

But also doesn't work,who can help?

=====更新====

=====UPDATE====

我尝试了添加PaymentDetails参数的方法,但似乎仍然无法使用,我发现了SetExpressCheckoutReq xml的架构, http://www.visualschema.com/vs/paypal/SetExpressCheckoutReq/,没有PaymentDetails的定义,谁曾做过这些事情,希望能为您提供帮助.

I tried the method of adding PaymentDetails parameter,but seems still not work,I found the schema of SetExpressCheckoutReq xml, http://www.visualschema.com/vs/paypal/SetExpressCheckoutReq/ , there is no definition of PaymentDetails,who did this stuff before,hope for your help.

====== FINAL =======

======FINAL========

我已解决此问题,新版本的ActiveMerchant支持订单详细信息审查,并且mwagg推出了有关此补丁的补丁程序,你们可以使用此版本 https://github.com/mwagg/active_merchant

I have fixed this issue,new version of ActiveMerchant support the order details review,and mwagg pushed the patch about this,you guys can use this version https://github.com/mwagg/active_merchant

这篇关于使用ActiveMerchant自定义Paypal Express的评论页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆