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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bc93bd88-eecd-420e-ae86-6253676fdf12%40googlegroups.com.

Reply via email to