1

I have a payment gateway Rest API URL. so I want the redirect to the payment gateway URL from my server-side Rest API when after order details successfully saved in the database.

Example

example.com (Client) -> POST Request -> pay.example.com/order(Nodejs) -> redirect with POST data -> paymentgateway.com/pay/xyz (payment gateway)

so how to redirect to the payment gateway website with POST data in Express Js?.

  • Does this answer your question? [posting to a remote url with expressjs](https://stackoverflow.com/questions/15409288/posting-to-a-remote-url-with-expressjs) – kewlashu Sep 23 '20 at 05:50
  • @kewlashu no. I don't want a response. I just want to redirect anthor website i mean payment gateway site with post data (payment details). – Haniman Ananthamoorthy Sep 23 '20 at 06:37
  • 1
    One way would be to render your `paymentgateway` page on the server-side, and then send the page to the client - rendering on the server side can be done with EJS (or other templating libraries). The render method allows you to pass data into the template page, which will then be rendered as HTML and sent to the client – Nick Parsons Sep 23 '20 at 11:12

1 Answers1

-3

Have you tried:

res.redirect('https://app.example.io');

https://expressjs.com/en/api.html#res.redirect

Nick Parsons
  • 45,728
  • 6
  • 46
  • 64
A.Varma
  • 10
  • 3