gpt4 book ai didi

php - 无法验证 Adyen 的 SSL 证书。 Adyen 支付

转载 作者:太空宇宙 更新时间:2023-11-03 15:13:26 31 4
gpt4 key购买 nike

当我在本地请求创建付款时,出现以下错误。我正在使用以下 api 进行付款。 https://github.com/Adyen/adyen-php-api-library

Fatal error: Uncaught exception 'Adyen\AdyenException' with message 'Could not verify Adyen's SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to https://pal-test.adyen.com/pal/servlet/Payment/v18/authorise in your browser.) If this problem persists, (Network error [errno 60]: SSL certificate problem: unable to get local issuer certificate)' in C:\xampp\htdocs\test\vendor\adyen\php-api-library\src\Adyen\HttpClient\CurlClient.php:210 Stack trace: #0 C:\xampp\htdocs\test\vendor\adyen\php-api-library\src\Adyen\HttpClient\CurlClient.php(74): Adyen\HttpClient\CurlClient->handleCurlError('https://pal-tes...', 60, 'SSL certificate...', Object(Monolog\Logger)) #1 C:\xampp\htdocs\test\vendor\adyen\php-api-library\src\Adyen\Service\AbstractResource.php(42): Adyen\HttpClient\CurlClient->requestJson(Object(Adyen\Service\Payment), 'https://pal-tes...', Array) #2 C:\xampp\htdocs\test\vendor\adyen\php-api-library\src\Adyen\Service\Payment.php(22): Adyen\Service\AbstractResource->request in C:\xampp\htdocs\test\vendor\adyen\php-api-library\src\Adyen\HttpClient\CurlClient.php on line 210

这是我用来创建付款的代码

<?php error_reporting(E_ALL);
ini_set('display_errors', 1);
include 'vendor/autoload.php';
if(isset($_POST['adyen-encrypted-data']))
{
echo 'test';
$client = new \Adyen\Client();
$client->setApplicationName("Adyen PHP Api Library Example");
$client->setUsername("myusername");
$client->setPassword("mypassword");
$client->setEnvironment(\Adyen\Environment::TEST);

$service = new Adyen\Service\Payment($client);

$json = '{
"amount": {
"value": 1499,
"currency": "GBP"
},
"reference": "payment-test",
"merchantAccount": "mymerchantaccount",
"additionalData": {
"card.encrypted.json": "'.$_POST["adyen-encrypted-data"].'"
}
}';

$params = json_decode($json, true);

$result = $service->authorise($params);
var_dump($result);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<link rel="stylesheet" href="">
</head>
<body>
<script type="text/javascript" src="https://test.adyen.com/hpp/cse/js/8214937568103526.shtml"></script>
<form method="POST" action="pay.php" id="adyen-encrypted-form">
<input type="text" size="20" data-encrypted-name="number"/>
<input type="text" size="20" data-encrypted-name="holderName"/>
<input type="text" size="2" data-encrypted-name="expiryMonth"/>
<input type="text" size="4" data-encrypted-name="expiryYear"/>
<input type="text" size="4" data-encrypted-name="cvc"/>
<input type="hidden" value="<?php echo date('Y-m-d').'T'.date('H:i:s', time()).'000Z'; ?>" data-encrypted-name="generationtime"/>
<input type="submit" value="Pay"/>
</form>
<script>
// The form element to encrypt.
var form = document.getElementById('adyen-encrypted-form');
// See https://github.com/Adyen/CSE-JS/blob/master/Options.md for details on the options to use.
var options = {};
// Bind encryption options to the form.
adyen.createEncryptedForm(form, options);
</script>
</body>
</html>

任何人都可以让我知道我如何解决这个问题或者我遗漏了什么吗?我认为,这与 php.ini 文件中的 php 配置有关?

最佳答案

我可以按照帖子中的解决方案修复它。

HTTPS and SSL3_GET_SERVER_CERTIFICATE:certificate verify failed, CA is OK

这在 Windows 中是一个很常见的问题。您只需将 cacert.pem 设置为 curl.cainfo。

从 PHP 5.3.7 开始,您可以:

下载https://curl.haxx.se/ca/cacert.pem并将其保存在某个地方。更新 php.ini -- 添加 curl.cainfo = "PATH_TO/cacert.pem"否则,您将需要为每个 cURL 资源执行以下操作:

curl_setopt ($ch, CURLOPT_CAINFO, "PATH_TO/cacert.pem");

关于php - 无法验证 Adyen 的 SSL 证书。 Adyen 支付,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43764743/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com