aya_cool
aya_cool

Reputation: 57

how to redirect to external web-page after successful payment?

I am using easy pay gateway for payment. After successful payment easy pay sends a response to my rest-api in express JS.

Now after verifying information in backend, I want to redirect to front-end page.
I used
res.redirect('https://front-end-url');
But it says not found.

I want to know if I do res.redirect() whats happens in browser. Did browser automatically redirect to webpage or client handles res.redirect() ?

Upvotes: 0

Views: 785

Answers (1)

jonathanrz
jonathanrz

Reputation: 4296

When you write res.redirect() the response to the client will be a 302 with the link to redirect.

This is the standard way to redirect a user, but what will happen in the client depends of the client it is using.

All common browsers will follow the 302 with the new endpoint and move the user to this page, but if the user is using an odd browser or anything like that, you should not be worried about it, the user can decide that he doesn't want to follow redirects or anything like and this is fine, he probably knows what he is doing.

The server should always follow the standard way :)

Upvotes: 0

Related Questions