Hi,
in the node.js server I got validation url from client and then post request to this url:
const { validationURL } = req.body;
const cert = fs.readFileSync(certPath);
const key = fs.readFileSync(keyPath);
const options = {
url: `${validationURL}/paymentSession`,
method: 'POST',
"headers": {
"Content-Type": "application/json",
},
key,
cert,
body:{
merchantIdentifier: 'merchant.domain.name', // from developer panel
displayName: 'ProjectName',
initiative: 'web',
initiativeContext: 'domain.name', // verified from developer panel
},
json: true,
};
let response = '';
request.post(options, function (error, response, body) {
console.log('inner error:', error);
console.log('inner statusCode:', response && response.statusCode);
console.log('inner body:', body);
}).on('error', function(err) {
console.log(err)
});
And I keep getting
inner error: null
inner statusCode: 404
inner body: Invalid URI -- no content
What may go wrong?
It's about url or body payload?
I form url according to https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/requesting_an_apple_pay_payment_session
Endpoint: https://{validation URL}/paymentSession
For Apple Pay on the web, use the fully qualified validation URL received in onvalidatemerchant.
request looks like this:
{ uri: 'https://apple-pay-gateway-pr-pod3.apple.com/paymentservices/startSession/paymentSession',
method: 'POST',
key: ,
cert: ,
body:
{ merchantIdentifier: 'merchant.domain.name',
displayName: 'ProjectName',
initiative: 'web',
initiativeContext: 'domain.name' },
json: true }
Any ideas?
With all best regards.