Django PayPal ipn 标准付款人地址



我正在使用django-PayPal的DCramer分支:https://github.com/dcramer/django-paypal

我正在使用 IPN 标准

我想做的是从 IPN 获取付款人(客户)地址。我可以从PayPal文档中看到此信息是与 IPN 一起发送的,并且通过查看 django-PayPal 数据库中有存储此数据的字段。 但是,这些数据并没有存储在 django-PayPal 提供的 PayPal_ipn 模型中。 我还检查了信号中的ipn_obj,这些数据的所有字段也是空白的。

谁能说明我如何能够获得付款人地址?

如果有帮助,我正在使用示例中的信号:

#Paypal signals
from paypal.standard.ipn.signals import payment_was_successful
import datetime
#Signal for paypal confirmation
def show_me_the_money(sender, **kwargs):
ipn_obj = sender
# Undertake some action depending upon `ipn_obj`.
payment_was_successful.connect(show_me_the_money)

编辑:

下面 scytale 建议的ipn_obj转储为相关字段生成了以下内容:

address_cityt(<type 'unicode'>)t: 
address_countryt(<type 'unicode'>)t: 
address_country_codet(<type 'unicode'>)t: 
address_namet(<type 'unicode'>)t: 
address_statet(<type 'unicode'>)t: 
address_statust(<type 'unicode'>)t: 
address_streett(<type 'unicode'>)t: 
address_zipt(<type 'unicode'>)t:

还有很多其他字段,如果您需要这些字段中的数据,请告诉我,我会将它们粘贴到此处。

听起来您一开始就没有得到地址信息。您可以要求PayPal从其PayPal帐户发送客户的地址,也可以从您网站上的客户那里获取地址,并将数据包含在PayPal按钮 HTML 中 - PayPal然后在 IPN 数据中将此信息发回给您。有关更多详细信息,请参阅表单基础知识指南。

由于你使用的是 django-PayPal(对吗?),你可以将这些数据包含在 PayPal 按钮中,只需将字段添加到你传递给PayPalPaymentsForm的初始值的字典中,如 django-PayPal 文档中所述。

最新更新