1

我正在一个市场(买家和卖家)工作,中间人得到每一次购买的削减。我想让买家在购买按钮被重定向到PayPal后立即购买商品。这很好,工作。贝宝自适应支付IPN回调:如何返回完整的未改变的ipn消息

response = ADAPTIVE_GATEWAY.setup_purchase(
    :return_url => 'return_url', 
    :cancel_url => 'cancel_url', 
    :ipn_notification_url => 'ipn_notification_url', 
    :receiver_list => recipients, 
) 
# ADAPTIVE_GATEWAY.set_payment_options(...) 
redirect_to (ADAPTIVE_GATEWAY.redirect_url_for(response['payKey'])) 

下一步是验证与ipn的事务。我确实收到PayPal回拨,但我不清楚应该退回哪些内容?

def notify_cb 
    notify = ActiveMerchant::Billing::Integrations::PaypalAdaptivePayment::Notification.new(request.raw_post) 

    if notify.acknowledge 
    update_attributes({ 
     :transaction_id => notify.transaction_id, 
     :status => notify.status 
    }) 
    end 

    render :nothing => true # render nothing?!? RENDER_LINE 
end 

这里的大多数示例上SO呈现什么(RENDER_LINE),而在PayPal文档的流动被描述为(https://www.x.com/developers/paypal/documentation-tools/ipn/integration-guide/IPNIntro#protocol_and_arch):

的IPN协议包括三个步骤:

  1. 贝宝向您的IPN监听器发送一条消息,通知您该事件

  2. 您的监听器发送完整的不变ed消息返回给PayPal;该消息必须包含相同顺序的相同字段并以与原始消息相同的方式进行编码

  3. PayPal发回一个单词,如果消息始于PayPal,则返回验证字,如果有,则返回INVALID什么最初发送

我的问题的差异是如何返回完整不变的消息回到贝宝或者我丢失/错误被我流的理解?

回答

1

您是否重新发布到https://sandbox.paypal.com/https://www.sandbox.paypal.com/cgi-bin/webscr(包括“cmd = _notify-validate作为POST数据的一部分,还是通过GET包含)?

前者返回HTTP 301,因为您基本上直接指向主页,而后者则直接指向承载IPN验证逻辑的页面。

+0

感谢Robert和周围的SO和Paypal文档挖掘应该指出并最终导致解决方案的几个错误: 1.在我的情况下张贴正确的网址是https://www.sandbox.paypal。 com/cgi-bin/webscr 2.将cmd = _notify-validate添加到最终帮助我获得了无效/已验证 3.根据http://activemerchant.rubyforge.org/classes/ActiveMerchant/Billing/Integrations/ Paypal/Notification.html#M000064 notify.acknowledge实际上发布到paypal – 2013-05-02 22:37:16