gpt4 book ai didi

ruby-on-rails - 如何正确设置 Active Paypal Adaptive Payment IPN Notifications?

转载 作者:太空宇宙 更新时间:2023-11-03 16:36:48 24 4
gpt4 key购买 nike

我一直无法在我的应用程序上设置 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

https://gist.github.com/8acceeee72fe12312c09

最佳答案

如果您指定遇到的问题,将会有很大帮助。比如notify_action是不是被Paypal的IPN命中的问题?还是 notify.acknowledge 返回 false?

对于严格的 IPN,这是我的工作 Controller 的样子:

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'

通知对象应包含给定购买的所有数据。

重要提示:查看日志文件以查看函数是否被调用,如果是,打印的是什么?

关于ruby-on-rails - 如何正确设置 Active Paypal Adaptive Payment IPN Notifications?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11554524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com