@alexmarion dude WTH. This should be in the documentation! I'm using node as backend to create the Apple Pay server as well. Also, I'm using node-fetch and custom https agent.
Here's two commands I've used to get the .key and .cert files https://stackoverflow.com/a/15144560
openssl pkcs12 -in certificado.p12 -out nuevo.crt.pem -clcerts -nokeys
openssl pkcs12 -in certificado.p12 -out nuevo.key.pem -nocerts -nodes
then it can be used like this
const httpsAgent = new https.Agent({
key: fs.readFileSync('nuevo.key.pem'),
cert: fs.readFileSync('nuevo.crt.pem'),
rejectUnauthorized: false
});
const options= {
merchantIdentifier: "merchant.prueba",
displayName: "Prueba",
initiative: "web",
initiativeContext: "foo-bar-test.ngrok.io"
};
fetch('https://apple-pay-gateway-cert.apple.com/paymentservices/startSession', {
method: 'POST',
body: JSON.stringify(options),
agent: httpsAgent
})
.then(function(response) {
return response.json();
}).then(function () {
// response
});