SSL 证书中的 authorize.net 支付网关错误
Error In authorize.net payment gateway in ssl certificate
我在php工作,刚集成授权支付网关
我关注了link
Php Integration Guide
然后我下载了这个
Php-SDK Example
但是每当我执行它时它都会向我显示错误,我已经检查了日志并且它向我显示
错误:SSL 证书问题:无法获取本地颁发者证书。
请提供具体的解决方案。
-充值-card.php
<?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";
}
?>
错误消息: 未捕获异常 'Exception' 消息 'Error getting valid response from api. Check log file for error details'
在日志文件中
错误: SSL 证书问题:无法获取本地颁发者证书
嗯,它是安全套接字层,主要用于对通过 Internet 发送的敏感信息进行加密,以便只有预期的接收者才能理解它。
删除 SSL:导航至 lib/net/authorize/util/HttpClient.php
第 68 行或附近添加以下内容
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)
和运行你的文件。
我在php工作,刚集成授权支付网关
我关注了link Php Integration Guide
然后我下载了这个 Php-SDK Example
但是每当我执行它时它都会向我显示错误,我已经检查了日志并且它向我显示 错误:SSL 证书问题:无法获取本地颁发者证书。 请提供具体的解决方案。
-充值-card.php
<?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";
}
?>
错误消息: 未捕获异常 'Exception' 消息 'Error getting valid response from api. Check log file for error details'
在日志文件中
错误: SSL 证书问题:无法获取本地颁发者证书
嗯,它是安全套接字层,主要用于对通过 Internet 发送的敏感信息进行加密,以便只有预期的接收者才能理解它。 删除 SSL:导航至 lib/net/authorize/util/HttpClient.php 第 68 行或附近添加以下内容
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)
和运行你的文件。