You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 12, 2020. It is now read-only.
I am using "paypal-rest-sdk": "1.8.1", I am getting this error:
problem with request: unable to verify the first certificate error { Error: unable to verify the first certificate at TLSSocket.<anonymous> (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
Here is my code:
`
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var paypal = require('paypal-rest-sdk');
I am using "paypal-rest-sdk": "1.8.1", I am getting this error:
problem with request: unable to verify the first certificate error { Error: unable to verify the first certificate at TLSSocket.<anonymous> (_tls_wrap.js:1116:38) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket._finishInit (_tls_wrap.js:643:8) at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' }
Here is my code:
`
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var paypal = require('paypal-rest-sdk');
app.use(bodyParser.urlencoded({ extended: false }))
console.log(__dirname);
app.use(express.static(__dirname + '/www/'));
app.get('/', function (req, res) {
res.sendFile(__dirname + '/www/home.html');
});
paypal.configure({
'mode': 'sandbox', //sandbox or live
'client_id': 'XXXXX',
'client_secret': 'XXXXX'
});
app.post('/makePayment', (req, res) => {
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://192.168.125.3:3000/home.html",
"cancel_url": "http://192.168.125.3:3000/cancel.html"
},
"transactions": [{
"item_list": {
"items": [{
"name": "item",
"sku": "item",
"price": "1.00",
"currency": "USD",
"quantity": 1
}]
},
"amount": {
"currency": "USD",
"total": "1.00"
},
"description": "This is the payment description."
}]
};
console.log(create_payment_json);
paypal.payment.create(create_payment_json, function (error, payment) {
if (error) {
console.log('error', error);
// throw error;
} else {
console.log("Create Payment Response");
for (let i = 0; i < payment.links.length; i++) {
if (payment.links[i].method = 'REDIRECT') {
res.redirect(payment.links[i].href);
break;
}
}
console.log(payment);
}
});
})
const port = 3000;
app.listen(port);
console.log('Server started listening on port 3000');
`
Please let me know where I am wrong and how can I resolve it.
The text was updated successfully, but these errors were encountered: