Last month our certificate key expired for Apple Pay, For generating new certificate
Followed this document TN3103: Apple Pay on the Web troubleshooting guide | Apple Developer Documentation )
- My payment service provider created certificate signing request (CSR).(Not provided key)
- Uploaded this CSR to the Merchant Configuration page to generate a Payment Processing Certificate
- Downloaded payment processing certificate
- Downloaded Merchant Identity Certificate
Both certificated installed in key chain, But the key file is not found so can't create Certificate.key.pem
`
public function apple_pay_session(Request $request)
{ $certificatePassphrase = "";
$merchantIdentifier = "merchant.name.com";
$displayName = "merchant name";
$initiative = "web";
$initiativeContext = "www.merchant.co.uk";
$certPass = "";
$certFile = public_path('merchant_id.pem');
$keyFile = public_path('Certificate.key.pem');
$data = '{"merchantIdentifier":"'.$merchantIdentifier.'","displayName":"'.$displayName.'","initiative":"'.$initiative.'","initiativeContext":"'.$initiativeContext.'"}';
try {
$ch1 = curl_init();
Storage::put('computop_applpay_try_session_'.time().'.txt', "In session");
// Check if initialization had gone wrong*
if ($ch1 === false) {
throw new Exception('failed to initialize');
}
curl_setopt($ch1, CURLOPT_URL, $request->validationUrl);
curl_setopt($ch1, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch1, CURLOPT_SSLKEY, $keyFile);
curl_setopt($ch1, CURLOPT_SSLKEYPASSWD, $certPass);
curl_setopt($ch1, CURLOPT_POST, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
$merchantSession = curl_exec($ch1);
// Check the return value of curl_exec(), too
if ($merchantSession === false) {
throw new Exception(curl_error($ch1), curl_errno($ch1));
}
return response()->json([
"merchantSession"=>$merchantSession,
"certFile" => $certFile
]);
} catch(Exception $e) {
Storage::put('computop_applpay_catch_session_'.time().'.txt', $e->getMessage());
return response()->json([
"code"=>$e->getCode(),
"msg" => $e->getMessage()
]);
}
}`
We only have apple_pay.cer ,merchant_id.cer, certificate signing request (CSR) provide by the payment service provider."
How to create merchant_id.pem,Certificate.key.pem from It..?
Or is it possible to do payment validation in PHP without these files?