Monday, 1 July 2019

Node.js PayUMoney Integration - response.headers.location is undefined

Tried 2 Node.js packages:
https://www.npmjs.com/package/payumoney_nodejs
https://www.npmjs.com/package/payumoney-node

Debugging on localhost.
Debugged in the index.js file under the node_modules in each package.

request.post(this.payUmoneyURL, form: params, headers: this.headers }, 
    function(error, response, body) {
        if (!error) {
            var result = response.headers.location;
            callback(error, result);
        }
});


request.post(payment_url[this.mode] + API.makePayment, { form: params, headers: this.headers }, function(error, response, body) {
        if (!error) {
            var result = response.headers.location;
            callback(error, result);
        }
});

Response of response.headers:

response.headers {
    date: 'Fri, 28 Jun 2019 12:06:35 GMT',
    server: 'Apache',
    'x-powered-by': 'PHP/7.2.14',
    p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
    'set-cookie': [ 'PHPSESSID=naopga57qf58vl0hdfj5krq4n5; path=/; domain=.payu.in' ],
    expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
    'cache-control': 'no-store, no-cache, must-revalidate',
    pragma: 'no-cache',
    vary: 'Accept-Encoding',
    'content-length': '3129',
    connection: 'close',
    'content-type': 'text/html; charset=UTF-8'
}

The above does not have location key like response.headers.location

Can someone help to know why location is not returned? Is it because of development on local machine? If yes, then how to test it on localhost?

Any help is appreciated.



from Node.js PayUMoney Integration - response.headers.location is undefined

1 comment:

  1. how to make a post request in postman

    ReplyDelete