0

これに答えるのを手伝ってくれる人に感謝します。私は Django e ラーニング サービスを実行していますが、これには 90 日間有効な 1 回払いのサブスクリプションが必要です。django-paypalを使用して支払いを統合しました。主な支払い方法として、Web Payments Standard の IPN (Instant Payment Notification) を使用しています。

質問 - 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)
4

1 に答える 1

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 が非常に紛らわしいことに気づきました!

于 2012-09-16T23:04:58.177 に答える