Search code examples
pythondjangopaypaldjango-paypal

Django-paypal "POST /notify/ HTTP/1.0" 500 59


   [31/Mar/2015 12:20:55] "POST /notify/ HTTP/1.0" 500 59

I get this error and no more. signal simple not connect

   @csrf_exempt
   def showme(sender,  **kwargs):
       ipn_obj = sender
       if ipn_obj.payment_status  == "Completed":
         user_profile = auth_user.objects.get(id=ipn_obj.custom)
         if user_profile.balance==None:
         user_profile.balance = float(10)
         else:
         user_profile.balance += float(10)
         user_profile.save()

  payment_was_successful.connect(showme)

My notify url

   @csrf_exempt
   def notify(request):
       payment_was_successful.connect(showme)
       return HttpResponse('OK4')

Solution

  • FIX the error by manually added notify url logic

    @csrf_exempt
    def notify(request):
        if request.POST.get("payment_status")  == "Completed":
         user_profile = auth_user.objects.get(id=request.POST.get("custom"))
         if user_profile.balance==None:
         user_profile.balance = float(10)
         else:
         user_profile.balance += float(10)
         user_profile.save()
         return HttpResponse('OK4')