集成 django-paypal
我正在尝试将 Django-Paypal 集成到一个网站上,一旦客户付款,我需要发送一个动态 URL,用户可以从中下载一些特定信息。
我将所有用户注册到一个 URL,允许他们购买该文档。该 URL 只能由使用 django-registration 验证电子邮件 ID 的注册用户访问,允许用户连接到 paypal 并进行付款。
如何捕获信号并根据此信息验证哪个用户已为他/她购买的产品付款
1)我需要知道两个信息,哪个用户进行了付款,以及他或她为哪个产品付款付款吗?
2) 只有当我有了这些信息,我才能通过电子邮件发送正确的 UR:L。
任何帮助表示赞赏。我不太确定 django-signals 是如何工作的。 payment_was_successful 信号返回哪些详细信息?
我正在使用IPN
I am trying to integrate Django-Paypal onto a site, where once the customer makes a payment I need to send a dynamic URL from which the user can download some specific information.
I am registering all users to a URL which allows them to buy the document. The URL which can only be accessed by a registered user with a verified email ids using django-registration, allows the user to connect to paypal and make payment.
How do I capture the signal and verify which user has made the payment for which product he/she is purchased, based on this information
1) I need to know two information, which user made the payment, and for which product did he or she make the payment?
2) Only if I have these information can I send the right UR:L by email.
Any help appreciated. I am not very sure how django-signals work. What all details does payment_was_successful signal return?
I am using IPN
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要捕获信号,您需要定义函数,并将其连接到信号,如下所示:
为了能够识别 IPN 消息所涉及的用户,我通常修改 paypal 按钮以传递名为
custom
在表单中设置为 djangouser.id
或其他一些您可以查找以识别您的用户的标识符。custom
变量在sender
参数中发回,您可以找到用户。为了查找产品,
product_name
也会在sender
中发送到上面列出的处理程序。您可能会有一个产品模型,并且您需要通过此产品名称查找它们,以便通过电子邮件发送适当的内容。To capture the signal, you define your function, and connect it to the signal like this:
To be able to identify the user the IPN message is about, I usually modify the paypal button to pass a field named
custom
along in the form set to the djangouser.id
or some other identifier you can look up to identify your user. Thecustom
variable is sent back in thesender
argument and you can find the user.To find the product, the
product_name
is also sent in thesender
to the handler listed above. You'll probably have a model for your products, and you'll want to look them up by this product_name to send the appropriate thing in email.