Hello fellow Stackers,
I am trying to implement Apple Pay on Web in our eCommerce.
I am just dealing with Merchant Identification Certificate problem.
We are using PHP 5.6 and curl to call Apple Pay validation to get ApplePaySession from Apple sessions.
I created a certificate in Apple Developer console, I downloaded and added that certificate into Keychain. Exported .p12 file and created two files: cert.pem with a certificate and key.pem with private key by these commands:
openssl pkcs12 -in applePayCert.p12 -out cert.pem -clcerts -nokeys
openssl pkcs12 -in applePayCert.p12 -out key.pem -nocerts -nodes
I am calling Apple Servers by curl
$data = json_encode([
'merchantIdentifier' => ADYENAPPLEPAY_APPLE_MERCHANT_IDENTIFIER,
'initiativeContext' => PRODUCTION_DOMAINNAME,
'displayName' => ADYENAPPLEPAY_APPLE_DISPLAY_NAME,
'initiative' => 'web',
]);
// create a new cURL resource
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $validationUrlFromApplePayJs);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSLCERT, PRODUCTION_CERTIFICATE_PATH);
curl_setopt($ch, CURLOPT_SSLKEY, PRODUCTION_CERTIFICATE_KEY);
$result = curl_exec($ch);
When I call
curl_error($ch)
I got
unable to use client certificate (no key found or wrong pass phrase?)
But I didn't set any password