Don't send POST to http://127.0.0.1:8000/cashfreeresponse,
Check your views and urls.py or redirect mechanism. Try to send like this 
==> http://127.0.0.1:8000/cashfreeresponse/

I simulate on my machine this. I got error like you when send POST request 
without '/' at the end.


9 Mart 2020 Pazartesi 23:23:24 UTC+3 tarihinde Sreekanth yazdı:
>
> I am unable to read POST parameters sent by payment gateway after payment 
> was processed. Payment gateway redirects to returnUrl (I pass this to 
> payment gateway before payment was processed) with some parameters by POST 
> request.
>
> In url.py
>
> path('cashfreeresponse/',views.cashfree_response, name='cashfree_response'),
>
> in views.py
>
> @csrf_exempt@login_requireddef cashfree_response(request):
>     print(request.method)
>     if request.method == "POST":
>         print('inside post method')
>         print(request.POST.get('cf_subReferenceId'))
>     if request.method == "GET":
>         print('inside get method')
>         print(request.GET.get('cf_subReferenceId'))
>
> print(request.method) is showing as GET but it was supposed be POST method 
> also print(request.GET.get('cf_subReferenceId')) and 
> print(request.POST.get('cf_subReferenceId')) are showing as None.
>
> But it looks like payment gateway sending parameters as POST method. When 
> I pass returnUrl as http://127.0.0.1:8000/cashfreeresponse instead of 
> http://127.0.0.1:8000/cashfreeresponse/ ('/' is missing in the first one) 
> then I am getting error as
>
> You called this URL via POST, but the URL doesn't end in a slash and you 
> have APPEND_SLASH set. Django can't redirect to the slash URL while 
> maintaining POST data. Change your form to point to 
> 127.0.0.1:8000/cashfreeresponse/ (note the trailing slash), or set 
> APPEND_SLASH=False in your Django settings.
>
> but I see in my google chrome page that payment gateway sending parameters 
> with POST request. Below image shows parameters sent by payment gateway by 
> POST request
>
> [image: enter image description here] 
> <https://i.stack.imgur.com/kmhg2.png>
>
> If I change urls.py to
>
> path('cashfreeresponse',views.cashfree_response, name='cashfree_response'),
>
> in settings.py to
>
> APPEND_SLASH = False
>
> and returnUrl to http://127.0.0.1:8000/cashfreeresponse then I am not 
> getting any error but still not receiving any parameters. How do I read 
> those parameters sent by payment gateway by POST request? Here 
> <https://docs.cashfree.com/docs/sbc/guide/#payment-response> is the 
> documentation for payment gateway.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05c3a1a5-306d-41d9-9f3e-c1c4a0bada59%40googlegroups.com.

Reply via email to