angularjs - Sending POST request from NODE server to payment gateway -
in current implmentation mean
stack, customers opting online payment, have created hyperlink this.
<div> <a class="btn btn-pram-primary btn-block" href="node/public/orders">online payment</a> </div>
and intercept url in node fallowing code.
var sendrequesttopayu = function( req, res, next ) { console.log('in sendrequesttopayu' ); var post_data = querystring.stringify({ 'txnid': '1', 'amount': '100', 'productinfo' : 'abcd', 'firstname' : 'username', 'email' : 'user@user.com', 'phone' : '9876543210' }); request({ url: 'https://test.payu.in/_payment', //url hit method: 'post', headers: { 'content-type': 'mycontenttype', 'content-length': post_data.length }, body: post_data //set body string }, function(error, response, body){ if(error) { console.log(error); } else { console.log(response.statuscode, body); res.html(body).send(); } }); };
for proper payment, control should transferred payment gateway site instead, in process coded above, not sure how can redirect control payment gateway ?
should handled on browser instead creating form , form action should url of payment gateway ?
if follow rule ? should not salt , merchant id visible client ?
please suggest me appropriate way pursue this.
i facing same problem while integrating payu website. although using php backend, solution problem generic.
what need handle 2 forms:
form : make user fill in form amount, set action of form form b.
form b(hidden) : form hidden in server , set action of form http://test.payu.in/_payment , auto submit form. form containing sensitive information merchant key , salt.
as parameters posted in form b, gets auto submit , redirects payu website along parameters of action.
your merchant key , salt secured in way on server.
Comments
Post a Comment