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 befo
APPEND_SLASH
shouldn't matter, as it only affects URLs that cannot be found, but you are explicitly specifying a URL pattern without a slash. So the issue is with your path definition.
Assuming we are talking about the main, project-level urls.py, the correct setting would be:
path('cashfreeresponse',views.cashfree_response, name='cashfree_response'),
returnUrl = 'http://127.0.0.1:8000/cashfreeresponse'
But my guess is that your path named cashfree_response
is defined in an app (e.g. polls/urls.py
) and that it is included at a subpath in the project-level (e.g. mysite/urls
) like that:
path('polls/', include('polls.urls')),
In that case, the correct returnUrl
would be http://127.0.0.1:8000/polls/cashfreeresponse
.
Instead of hard-coding the URL, you can use reverse
together with request.
from django.urls import reverse
request.build_absolute_uri(reverse('cashfreeresponse')
Note: You might have to use reverse('<appname>:cashfreeresponse')
here, e.g. reverse('polls:cashfreeresponse')
Edit: from your update, it seems like you still have a trailing slash in the path definition:
path('cashfreeresponse/',views.cashfree_response, name='cashfree_response'),
Change that to:
path('cashfreeresponse',views.cashfree_response, name='cashfree_response'),
@login_required
decorator was causing the issue. I think @login_required
redirecting the page to see if user logged in (even if user already logged in) then redirecting back to this view. During this process, it is loosing POST data and converting the request method to GET.