Hi,
I am trying to validate merchant through node express.js . Below is my code
app.get('/merchant-session/new', function (req, res) {
var uri = req.query.validationURL || 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession';
var options = {
uri: uri,
json: {
merchantIdentifier: "merchant...",
displayName: "....",
domainName: "fe-uat2-..."
},
agentOptions: {
cert: cert,
key: cert
}
};
request.post(options, function (error, response, body) {
if (body) {
// Apple returns a payload with `displayName`, but passing this
// to `completeMerchantValidation` causes it to error.
delete body.displayName;
}
console.log('body =>>>>>', body);
console.log('respnse =>>>>>', response)
res.send(body);
}, (error) => {
console.error(`error =>>>>`, error);
});
});
I am getting undefined in response.
I have generate certificate from KeyChain Access and uploaded that to get Apple Pay Merchant Identity Certificate.
Then dowloaded the certificate and saved in KeyChain Access and the exported as pem.
And passed as cert and key.
Certificate is from developer Account and I have logged in icloud with Sandbox account to test pay. Don't know if this is the issue.
Anyone, please help.