1

I am integrating payumoney payment gateway in my reactjs website. the success url for the successful transaction is post method. so whenever transaction got success, page got redirected to success url which is not loaded, since it is post request. So how i can fetch the details and load my website.

Riyas TK
  • 1,231
  • 6
  • 18
  • 32
  • 1
    This is something you handle on the backend/server not `react`. – Brahma Dev Oct 23 '17 at 10:35
  • But the success url is getting shown on success in my webpage – Riyas TK Oct 23 '17 at 11:25
  • But the success url is getting shown on success in my webpage – Riyas TK Oct 23 '17 at 11:25
  • That's because the browser is supposed to show the url. You wouldn't want your credit card details to be magically posted to any random url that is not visible in the address bar. I'll repeat again. POST is handled on the backend. Why would the browser POST something to itself ? If you want to avoid it, see if the API allows GET request. You can then parse the query string inside the browser. – Brahma Dev Oct 23 '17 at 11:37
  • I should add that this would possibly make your app insecure, because anyone can open your success page with random data in the query string and it would behave as if it was a real payment. – Brahma Dev Oct 23 '17 at 11:41
  • payumoney gateway send the response to succes url as post method and website is automatically redirected to that post page. Payumoney provides only post method as success. How to handle this case – Riyas TK Oct 23 '17 at 11:42
  • You handle it on the backend. It's sensitive payment data. It's not supposed to be directly accessible to the frontend. You need a backend/server to process the POST request. Like `express` in node.js. – Brahma Dev Oct 23 '17 at 11:45
  • i understand that the post request is to be handled by backend. But the success url which i mentioned will shown in browser on transaction successful which will be my server address. How to prevent that. – Riyas TK Oct 23 '17 at 11:59
  • I am not sure what you want. You want to hide the URL ? Or redirect to a different URL ? – Brahma Dev Oct 23 '17 at 12:05
  • Did you find a working solution for this? I am about to start PayU integration and am using Reactjs – Varun Agarwal Sep 26 '20 at 13:10

1 Answers1

1

You must have an API endpoint as success url. I implemented this by set success url to my backend, and from there accept the post request and redirect to front end page

PranavPinarayi
  • 3,037
  • 5
  • 21
  • 32