Thanks to anyone who can help me answer this. I'm running a Django e-learning service that requires a one-time payment subscription that lasts 90 days. I have used django-paypal to integrate my payment. I use IPN (Instant Payment Notification) on Website Payments Standard as my main mode of payment.
The question -- on receiving the IPN signal payment_was_successful
, I signal the following permission:
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)
I am trying to figure out how to "expire" the subscription in 90 days automatically. i.e.:
permission - Permission.objects.get(name="Subscribed")
student.user_permissions.remove(permission)
No tested but from what I know, it might work.
Paypal can handle subscriptions for you: https://github.com/johnboxall/django-paypal/blob/master/README.md#using-paypal-payments-standard-with-subscriptions
Your signal will probably not be payment_was_successful but be one of these:
Good luck, I've found django-paypal quite confusing!