Hi Guys,
I'm struggling with an error on the request to start session with apple pay web, find below the error:
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
I've done the following process:
1. created the merchant-id
2. Generated the Apple Pay Payment Processing Certificate (apple_pay.cer) - installed on my mac
3. Verified my domain
4. Generated the Apple Pay Merchant Identity Certificate (merchant_id.cer) - installed on my mac
5. Opened the Keychain and found the merchant_id.cer
6. Right click on merchant_id.cer -> export -> merchant.com.xxxxx.pem
7. Moved the merchant.com.xxxxx.pem to the project cert folder
When the client-side call the API, I have the following request which is returing the error above:
const options = {
url: req.body.url,
cert: applePayCert, //fs.readFileSync(APPLE_PAY_CERTIFICATE_PATH
key: applePayCert, //fs.readFileSync(APPLE_PAY_CERTIFICATE_PATH
method: 'post',
body: {
merchantIdentifier: "merchant.com.xxxxx.pem",
//domainName: MERCHANT_DOMAIN,
displayName: 'My Store',
initiative: 'web',
initiativeContext: 'www.xxxxxx.com'
},
json: true,
}
console.log(options);
// Send the request to the Apple Pay server and return the response to the client
request(options, function(err, response, body) {
if (err) {
console.log('Error generating Apple Pay session!');
console.log(err, response, body);
return res.status(400).send(body);
}
res.send(body);
});
I'm trying to run on my localhost and also heroku server, but I get this error:
Does anyone had the same issue or know what I could be missing?
2018-08-10T15:21:01.939694+00:00 app[web.1]: Error generating Apple Pay session!
2018-08-10T15:21:01.945778+00:00 app[web.1]: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
2018-08-10T15:21:01.945781+00:00 app[web.1]: at Object.createSecureContext (_tls_common.js:104:17)
2018-08-10T15:21:01.945782+00:00 app[web.1]: at Object.exports.connect (_tls_wrap.js:1049:48)
2018-08-10T15:21:01.945784+00:00 app[web.1]: at Agent.createConnection (https.js:111:22)
2018-08-10T15:21:01.945785+00:00 app[web.1]: at Agent.createSocket (_http_agent.js:227:26)
2018-08-10T15:21:01.945787+00:00 app[web.1]: at Agent.addRequest (_http_agent.js:185:10)
2018-08-10T15:21:01.945806+00:00 app[web.1]: at new ClientRequest (_http_client.js:258:16)
2018-08-10T15:21:01.945807+00:00 app[web.1]: at Object.request (http.js:38:10)
2018-08-10T15:21:01.945809+00:00 app[web.1]: at Object.request (https.js:239:15)
2018-08-10T15:21:01.945811+00:00 app[web.1]: at Request.start (/app/node_modules/request/request.js:747:32)
2018-08-10T15:21:01.945819+00:00 app[web.1]: at Request.write (/app/node_modules/request/request.js:1492:10) undefined undefined