#I can’t change how the payment gateway
1 messages · Page 1 of 1 (latest)
Hi
What status code are you using for your redirect btw?
You are absolutely right, the redirection is failing cause of the POST method
when i paste the same url to a new tab browser is making a GET request
So do you have any idea on how to allow this 405 method?
Thank you so much
did you set up CORS when you set up your Next project?
(If not don't worry about it)
I have Next JS with a Python + Django backend. This redirection is caused by the payment gateway though not the Django backend.
CORs is set between Next JS and Django...
Django sets the CORS?
Or does Next?
And does your payment gateway redirect to Next or Django?
Django is the backend server, so it returns the appropriate CORS headers.
I place the payment in Next js and the paytm thing redirects from the bank payment page to the next js page
Django is not involved that much into this redirection.. so it doesnt have too much role in it.
Once the payment is completed and done, payment gateway redirects to the callback.
See here's the flow.
Payment request (next js) -> Payment token (django) -> using that token next js opens up the payment window -> Payments Bank page -> callback url (next js)
And you're failing in the last step?
Yeah because the payment gateway is sending a POST request to the next js callback which apparently not allowed
Is your callback URL a page or an API endpoint?
but the payment is captured
It's a page.
I take this param from the callback url : ?orderId=39_6359692232 check it and then show it in the page.. its a page not an endpoint basically.
Ok so I think I might have to change the flow a bit.
Here's what I suggest you do:
POST instead to an API route whose ONLY job is to redirect you to your page.
Payment request (next js) -> Payment token (django) -> using that token next js opens up the payment window -> Payments Bank page -> callback url (next js API route) -> page (next js)
Does that make sense?
Ok got it. thank you so much.
i wanted to ask one last thing
how to redirect rom API route to the page
The next docs are VERY useful. I suggest you learn how to use them!
res.redirect([status,] path)
Got this from the docs thank you.
:)
Thank you so much for your time again.