Django Paypal订阅

时间:2012-08-06 00:45:45

标签: django paypal django-paypal

感谢所有能帮助我解答此问题的人。我正在运行Django电子学习服务,该服务需要一次性付费订阅,持续90天。我使用django-paypal来整合我的付款。我使用网站付款标准上的IPN(即时付款通知)作为我的主要付款方式。

问题 - 在收到IPN信号payment_was_successful时,我发出以下许可信号:

def purchase_success(sender, **kwargs):
    ipn_obj = sender
    student = User.objects.get(username=str(ipn_obj.custom))
    permission = Permission.objects.get(name="Subscribed")
    student.user_permissions.add(permission)
payment_was_successful.connect(purchase_success)

我想弄清楚如何过期"自动订阅90天。即:

permission - Permission.objects.get(name="Subscribed")
student.user_permissions.remove(permission)

1 个答案:

答案 0 :(得分:0)

没有经过测试,但据我所知,它可能有用。

Paypal可以为您处理订阅: https://github.com/johnboxall/django-paypal/blob/master/README.md#using-paypal-payments-standard-with-subscriptions

"p3": 90,                          # duration of each unit (depends on unit)
"t3": "D",                         # duration unit ("D for Day")

你的信号可能不会是payment_was_successful但是其中之一:

subscription_cancel - Sent when a subscription is cancelled.
subscription_eot - Sent when a subscription expires.
subscription_modify - Sent when a subscription is modified.
subscription_signup - Sent when a subscription is created.
祝你好运,我发现django-paypal非常混乱!