#I can’t change how the payment gateway

1 messages · Page 1 of 1 (latest)

glacial hill
#

You still here?

grand spoke
glacial hill
#

What status code are you using for your redirect btw?

grand spoke
#

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

glacial hill
#

did you set up CORS when you set up your Next project?

#

(If not don't worry about it)

grand spoke
#

CORs is set between Next JS and Django...

glacial hill
#

Django sets the CORS?

#

Or does Next?

#

And does your payment gateway redirect to Next or Django?

grand spoke
# glacial hill Django sets the CORS?

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.

glacial hill
#

So is the callback on your Next server?

#

Like you're calling back to your Next URL?

grand spoke
glacial hill
#

And you're failing in the last step?

grand spoke
glacial hill
#

Is your callback URL a page or an API endpoint?

grand spoke
#

but the payment is captured

grand spoke
glacial hill
#

got it.

#

POST requests are only allowed for API routes.

grand spoke
#

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.

grand spoke
glacial hill
#

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?

grand spoke
#

i wanted to ask one last thing

#

how to redirect rom API route to the page

glacial hill
#

The next docs are VERY useful. I suggest you learn how to use them!

grand spoke
glacial hill
#

:)

grand spoke