django-paypal does not receive ipn signal -


i trying use django-paypal. following mentioned in jay on django

here did...

##in view.py file     def ask_payment(request):    # want button do.    paypal_dict = {     "business": settings.paypal_receiver_email,     "amount": "0.10",     "item_name": "book",     "invoice": "yong138peng",     "notify_url": "http://127.0.0.1:8000/accounts/my-ipn-location/",     "return_url": "http://127.0.0.1:8000/accounts/my-return-location/",     "cancel_return": "http://127.0.0.1:8000/accounts/my-cancel-location/",    }      # create instance.    form = paypalpaymentsform(initial=paypal_dict)    context = {"pp_form": form}    return render_to_response("paypal/payment.html",{'pp_form':form},context_instance=requestcontext(request))  @csrf_exempt def payment_status(request,status):    return render_to_response("paypal/payment_status.html",                     {'status':status},context_instance=requestcontext(request))  ##then in urls.py file  (r'^askforpayment/$','coltrane.views.ask_payment'), (r'^my-ipn-location/', include('paypal.standard.ipn.urls')), (r'^my-return-location/$','coltrane.views.payment_status',{'status':'success'}), (r'^my-cancel-location/$','coltrane.views.payment_status',{'status':'cancel'}),  ##in models.py def show_me_the_money(sender, **kwargs):    ipn_obj = sender    print "payment successful!"    # undertake action depending upon `ipn_obj`.    if ipn_obj.custom == "upgrade users!":  ## for, sent paypal??        users.objects.update(paid=true)         payment_was_successful.connect(show_me_the_money) 

my question are:

  1. according jay on django, have put @csrf_exempt before paypay.standard.ipn.views.ipn function avoid django complaining @csrf_token problem. did still facing same problem. put @csrf_exempt before return url view function, in case payment_status(request,status), the csrf_token problem gone. not sure why case.

  2. what statement in signal handler for? "if ipn_obj.custom == "upgrade users!": .... " coming paypay? possible value besides "upgrade users?"

  3. i manage purchase , complete whole payment process @ sandbox. problem paypal not post ipn notify_url localhost. read paypal sandbox ipn problem cannot use localhost (http://127.0.0.1:8000) test ipn. steps needed test? don't understand solution provided in post. can teach me how test ipn without deploying real production server?

i stuck on problem long time! turns out had error in signals code error never displayed, appeared though signal not being called. tracked down modifying code in paypal-django this:

in paypal.standard.ipn.views.py - 3 lines bottom:

        try:             ipn_obj.verify(item_check_callable)         except:             import sys, traceback             traceback.print_exc(file=sys.stdout) 

then check apache error log errors.


Comments