【发布时间】:2018-04-12 04:51:57
【问题描述】:
我在我的 Django 项目中集成了 Paypal IPN 付款方式。我正在使用django-paypal django 包。
我可以使用沙盒进行付款,而且一切顺利,但我没有在我的应用程序中获取交易详细信息以供将来参考(即交易 ID、日期、参考详细信息等)。我在开始付款时发送以下参数。
paypal_dict = {
"business": "xxxxxxxx@mail.com",
"amount": subscriptions.price,
"item_name": subscriptions.name,
"invoice": subscriptions.invoice_no,
"notify_url": request.build_absolute_uri(reverse('paypal-ipn')),
"return_url": request.build_absolute_uri(reverse('subscriptions:return_url')),
"cancel_return": request.build_absolute_uri(reverse('subscriptions:cancel_return')),
"custom": "premium_plan", # Custom command to correlate to some function later (optional)
# "landing_page": "billing",
"paymentaction": "authorization",
"first_name": company_profile.company_name,
"last_name": "",
"address1": company_profile.address_1,
"address2": company_profile.address_2,
"city": company_profile.city,
"country": company_profile.country,
"state": company_profile.state,
"zip": company_profile.zip_code,
"email": company_profile.email,
"night_phone_a": company_profile.work_phone
}
我读到 IPN 一直在发送响应,但不确定我是否错过了设置任何参数。
我检查了 notify_url 是否可以从外部访问,但我没有看到 paypal 调用我的 notify_url。
您的宝贵意见将对我们有很大帮助。提前谢谢!!!!!!
【问题讨论】:
-
documentation 中的第 4 点提到了
notify_url。这个url是webhook URL,调用成功和失败的详细信息。 -
您的
notify_url必须可以从外部访问。请注意,沙盒有时不会发送 IPN 消息,因为它已完全损坏。例如,上周我收到了大部分 IPN 消息(退款通知除外),但今天我没有收到一条消息,浪费了整个开发日。我的代码根本没有改变。 Paypal 就是毒药。 -
我检查了 notify_url 是否可以从外部访问,但我没有看到 paypal 调用我的 notify_url。
标签: python django paypal paypal-sandbox paypal-ipn