我一直无法在我的应用上设置IPN通知以获取所有信息 发回我的申请表。我的付款工作正常且功能正常。我遇到了notify_action的问题。我想检索付款信息并将其发回我的应用程序以获取付款的所有信息。
def checkout
....
response = @gateway.setup_purchase(
:return_url => "http://localhost:3000",
:cancel_url => "http://localhost:3000",
:ipn_notification_url => orders_notify_action_url,
:receiver_list => recipients
)
..
redirect_to (@gateway.redirect_url_for(response["payKey"]))
end
def notify_action
notify = ActiveMerchant::Billing::Integrations::PaypalAdaptivePayment::Notification.new(request.raw_post)
p "Notification object is #{notify}"
if notify.acknowledge
p "Transaction ID is #{notify.transaction_id}"
p "Notification object is #{notify}"
p "Notification status is #{notify.status}"
end
render :nothing => true
end
答案 0 :(得分:1)
如果您指定了您遇到的问题,那将会有很大帮助。例如,paypal的IPN没有击中notify_action的问题?或者notify.acknowledge返回false?
对于严格的IPN,这就是我的工作控制器的样子:
class PayController < ApplicationController
include ActiveMerchant::Billing::Integrations
def paypal
notify = Paypal::Notification.new(request.raw_post)
logger.debug "Notification object is #{notify}"
if notify.acknowledge
logger.debug "Transaction ID is #{notify.transaction_id}"
logger.debug "Notification object is #{notify}"
logger.debug "Notification status is #{notify.status}"
end
render :nothing => true
end
end
然后我给Paypal的网址是www.yourwebsite.com/pay/paypal
然后简单地匹配route.rb中的路线
match 'pay/paypal' => 'pay#paypal'
通知对象应包含给定购买的所有数据。
重要提示:观察日志文件以查看是否有人调用该函数,如果是,则打印什么内容?