django-paypal 没有收到信号

发布于 2024-10-26 20:13:01 字数 594 浏览 1 评论 0原文

我有一个沙盒PAYPAL区域, 我的语言是 python - Django,我使用 django-paypal 我的服务器上的 ipn tes 可以工作,但是 当有人尝试购买东西时,在沙箱中进行贝宝处理后,我没有收到信号,并且在我的贝宝 IPN 中我看不到交易。 所以问题是我收不到信号。 这是我在 models.py 中的信号代码

from paypal.standard.ipn.signals import payment_was_successful

def show_me_the_money(sender, **kwargs):
    code = sender.item_number
    type, number_product, pagamento_corso_id = code.split('_')
    obj = get_object_or_404(PagamentoCorso, int(pagamento_corso_id))
    obj.pagamento = True
    obj.save()

payment_was_successful.connect(show_me_the_money)

请帮助我,因为是 7 天......我非常沮丧! :-)

I have a sandbox PAYPAL area,
My language is python - Django and I use django-paypal
ipn tes on my server works but
when someone try to buy something, after paypal process in sandbox I don't receive signal and in my paypal_ipn I don't see the transaction.
So the problem is that I don't receive the signal.
This is my signal code in models.py

from paypal.standard.ipn.signals import payment_was_successful

def show_me_the_money(sender, **kwargs):
    code = sender.item_number
    type, number_product, pagamento_corso_id = code.split('_')
    obj = get_object_or_404(PagamentoCorso, int(pagamento_corso_id))
    obj.pagamento = True
    obj.save()

payment_was_successful.connect(show_me_the_money)

Please help me because is 7 days... and I'm very frustrated! :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

樱花坊 2024-11-02 20:13:01

我认为您可以使用 Paypal 测试工具向您的通知网址发送虚假通知。这可能会使调试更容易。

http://www.friend-stranger.com/pictures/paypal.jpg

您还可以运行 django-paypal 附带的测试。它应该类似于

python manage.py test paypal

您还可以查看测试代码并创建您自己的测试来调试您的问题。

如果您仍然无法弄清楚,请发布您的 url 配置以及将 IPN 表单传递给模板的视图。

I think you can use the Paypal Test Tools to send fake notifactions to your notify url. That might make it easier to debug.

http://www.friendly-stranger.com/pictures/paypal.jpg

What you can also do is run the tests that come with django-paypal. It should be something like

python manage.py test paypal

You can also take a look at the test code and create your own tests to debug your problem.

If you still can't figure it out post your url configuration and the view that passes the IPN form to the template.

尹雨沫 2024-11-02 20:13:01

我有类似的问题。就我而言,我可以从访问日志中看到 PayPal 正在访问我的付款通知 URL,并且请求为 200 OK,但 Django 端没有触发任何信号。

事实证明,付款状态为“待处理”而不是“已完成”(而且我没有监听 paypal.standard.ipn.signals. payment_was_flaagged 信号)。

我的付款被标记的原因是 settings.PAYPAL_RECEIVER_EMAILpaypal_dict["business"] 电子邮件地址不正确。 与此人完全相同的问题

I had a similar problem. In my case, I could see from access logs that PayPal is accessing my payment notification URL, and the requests are 200 OK, but no signals triggered on Django side.

Turned out that payments had "Pending" status instead of "Completed" (and I wasn't listening on paypal.standard.ipn.signals.payment_was_flagged signal).

The reason my payments were flagged, was incorrect settings.PAYPAL_RECEIVER_EMAIL and incorrect paypal_dict["business"] email addresses. Exact same issue as for this guy.

转身以后 2024-11-02 20:13:01

就我而言,原因很简单 - 我已将信号处理程序代码添加到 views.py 中,该代码不会自动加载,因此处理程序从未真正使用并连接到信号。最简单但丑陋的解决方案是将它们移动到 models.py,推荐使用 Django 的 ready() 方法。

In my case the reason was trivial - I've added the signal handler code to views.py which is not loaded automatically so the handler was never really used and connected to the signal. The simplest but ugly solution is to move them to models.py, recommended is to use Django's ready() method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文