Php ssl证书中的authorize.net支付网关出错
我在php工作,只是集成了授权支付网关 我遵循以下链接 然后我下载了这个 但每当我执行它时,它都会向我显示错误,我已经检查了日志,它会向我显示 错误:SSL证书问题:无法获取本地颁发者证书。 请给我提供一定的解决方案 -charge credit card.phpPhp ssl证书中的authorize.net支付网关出错,php,payment-gateway,authorize.net,Php,Payment Gateway,Authorize.net,我在php工作,只是集成了授权支付网关 我遵循以下链接 然后我下载了这个 但每当我执行它时,它都会向我显示错误,我已经检查了日志,它会向我显示 错误:SSL证书问题:无法获取本地颁发者证书。 请给我提供一定的解决方案 -charge credit card.php <?php require 'vendor/autoload.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\contr
<?php
require 'vendor/autoload.php';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName("API-key");
$merchantAuthentication->setTransactionKey("Trans-Key");
$refId = 'ref' . time();
// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber("370000000000002");
$creditCard->setExpirationDate("2038-12");
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);
// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount(151.51);
$transactionRequestType->setPayment($paymentOne);
$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
if ($response != null) {
$tresponse = $response->getTransactionResponse();
if (($tresponse != null) && ($tresponse->getResponseCode() == "1")) {
echo "Charge Credit Card AUTH CODE : " . $tresponse->getAuthCode() . "\n";
echo "Charge Credit Card TRANS ID : " . $tresponse->getTransId() . "\n";
} else {
echo "Charge Credit Card ERROR : Invalid response\n";
}
} else {
echo "Charge Credit Card Null response returned";
}
?>
错误消息:未捕获异常“异常”,消息为“从api获取有效响应时出错”。检查日志文件以获取错误详细信息'
日志文件中的错误:SSL证书问题:无法获取本地颁发者证书嗯,它是安全套接字层,主要用于对通过Internet发送的敏感信息进行加密,以便只有预期的收件人才能理解。 要删除SSL,请导航到lib/net/authorize/util/HttpClient.php 第68行或附近添加以下内容
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)
并运行您的文件。未来读者:不要这样做!首先,您正在禁用金融交易的加密。其次,您正在修改供应商代码(这意味着如果您更新或重新安装库,“修复程序”将再次中断)。@greenie2600还有其他修复程序吗?我刚刚安装了SSL,现在我遇到了这个错误。