Paypal Express Checkout Integration


#1

Hi all,
I am integrating paypal express in my application with npm package paypal-ec.
I have implemented everything as per its documentations. It is generating paypal url and redirecting to it but it is not redirecting back to my local url and getting 500 internal server error instead.

Here is my router file
Picker.route(’/makePayment’, function(params, req, res, next) {
var url = generate_URL_for_payment_authorization(‘123’,2);

    if (url == null) 
        this.response.end("error"); 
 
  res.writeHead(301, { 'Location': url}); 
    res.end(); 
}); 
 
Picker.route('/paymentReturn', function(params, req, res, next) { 
    result = paypal_return('123',2,params.query.token,params.query.PayerID);
    console.log(result)
}

Any suggestions or help?