I have this PHP code to connect to apple pay (WEB):
$validationPayload = json_encode([
'merchantIdentifier' => "merchant.com.XXXXXX",
'displayName' => "XXXX",
'initiative' => "web",
'initiativeContext' => "my_domain.com"
]);
$response = (new Client())->post('https://apple-pay-gateway-cert.apple.com/paymentservices/startSession', [
'headers' => [
'Content-Type' => 'application/json'
],
'body' => $validationPayload,
'cert' => storage_path('apple-pay/certificate.pem'),
])
->getBody()
->getContents();
return $response;
I got the cer file from the payment gateway and import it to my account and activate it. I uploaded the cer file in (Apple Pay Payment Processing Certificate)
I converted this cer file to pem by this command:
openssl x509 -inform DER -in apple_pay.cer -out certificate.pem
When I call the code above I get this error:
"cURL error 58: unable to set private key file: '/Users/a/Documents/Sites/ish/storage/apple-pay/certificate.pem' type PEM (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://apple-pay-gateway-cert.apple.com/paymentservices/startSession"
So how can I convert the cer(that the payment gave to me by the gateway) to pem ?