我在php工作,只是集成了授权支付网关
我按照以下链接 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";
}
?>
错误消息:未捕获的异常&#39;异常&#39;有消息&#39;错误从api获得有效响应。检查日志文件以获取错误详细信息&#39;
在Log FIle中
错误: SSL证书问题:无法获取本地颁发者证书
答案 0 :(得分:5)
嗯,它是安全套接字层,主要用于保持通过Internet加密发送的敏感信息,以便只有预期的收件人才能理解它。 删除SSL:导航到lib / net / authorize / util / HttpClient.php 第68行或附近添加以下内容
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)
并运行您的文件。