gpt4 book ai didi

php - ssl 证书中的 authorize.net 支付网关出错

转载 作者:行者123 更新时间:2023-12-04 22:09:53 26 4
gpt4 key购买 nike

我是用php工作的,刚刚集成了授权支付网关

我点击了以下链接 Php Integration Guide

然后我下载了这个 Php-SDK Example

但是每当我执行它时它都会向我显示错误,我已经检查了日志并且它向我显示错误:SSL 证书问题:无法获取本地颁发者证书。请为我提供特定的解决方案。

-charge-credit-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";
}
?>

错误消息:未捕获异常“异常”,消息为“从 api 获取有效响应时出错。检查日志文件以获取错误详细信息'

在日志文件中
错误: SSL 证书问题:无法获取本地颁发者证书

最佳答案

嗯,它是 Secure Socket Layer ,主要用于对通过 Internet 发送的敏感信息进行加密,以便只有预期的接收者才能理解它。删除 SSL:导航到 lib/net/authorize/util/HttpClient.php第 68 行或附近添加以下内容

curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)

并运行你的文件。

关于php - ssl 证书中的 authorize.net 支付网关出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33053763/

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