Search code examples
pythondjangopaypalpaypal-ipndjango-paypal

django-paypal signals not firing


I have tried for hours to get my signals to work with django-paypal.

Here is my signals.py (which is imported in my urls.py):

from django.dispatch import receiver
from paypal.standard.ipn.signals import payment_was_successful, payment_was_flagged

@receiver(payment_was_successful)
def confirm_admin_payment(sender, **kwargs):
    print 'SUCCESS: %s' % sender.payer_email

@receiver(payment_was_flagged)
def payment_flagged(sender, **kwargs):
    print "FLAGGED: %s" % sender.payer_email

print "signals.py has been imported"

When I use PayPal's IPN simulator, I know the transaction works because I can go into the database, look at the paypal_ipn table and see the transaction entered just fine, so the signals SHOULD be working.

I have also tried both dcramer's and johnboxall's versions of django-paypal, but still no joy.

I'm out of ideas, I've put hours into researching and trying to figure this thing out. Thanks in advance guys.


Solution

  • See for errors/warnings in payment transaction. Signal payment_was_successful fired only when there is no flags on transaction, even if flags wasn't critical at all (f.e. if your settings.PAYPAL_RECEIVER_EMAIL != transaction reciever email).

    You may debug standard.ipn.models.PayPalIPN.send_signals method using pdb at start, is it fired at all? Don't be shine to modify third-party-code for debugging purposes.