OKHTTP SSL证书请求

时间:2018-06-21 13:47:04

标签: java okhttp3 applepay okhttp

对于我们的Applepay集成,我们想使用OKHttp3客户端库。作为OkHttp Client请求的一部分,我们被阻止了如何以PEM格式发送TLS / SSL证书。 (请参阅:请求选项参数cert:applePayCert,密钥:applePayKey,)

这是NodeJS中的一个有效示例

 const options = {
    url: "https://apple-pay-gateway-cert.apple.com/paymentservices/startSession",
    cert: applePayCert,
    key: applePayKey,
    method: 'post',
    body: {
        merchantIdentifier: MERCHANT_IDENTIFIER,
        domainName: "mydomain.com",
        displayName: 'myname',
    },
    json: true,
}
console.log("url is "+options.url);

// 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);
        res.status(500).send(body);
    }
    res.send(body);
});

0 个答案:

没有答案