【问题标题】:Error In authorize.net payment gateway in ssl certificatessl证书中的authorize.net支付网关错误
【发布时间】:2016-01-08 07:36:39
【问题描述】:

我是做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 证书问题:无法获取本地颁发者证书

【问题讨论】:

    标签: php payment-gateway authorize.net


    【解决方案1】:

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

    curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, FALSE)
    

    并运行您的文件。

    【讨论】:

    • 未来读者:不要这样做!首先,您要禁用金融交易的加密。其次,您正在修改供应商代码(这意味着如果您更新或重新安装库,“修复”将再次中断)。
    • @greenie2600 还有其他修复方法吗?我刚刚安装了我的 SSL,现在我收到了这个错误。
    猜你喜欢
    • 2011-12-20
    • 2018-04-15
    • 2016-10-21
    • 2018-11-09
    • 1970-01-01
    • 1970-01-01
    • 2018-11-24
    • 1970-01-01
    • 2013-11-02
    相关资源
    最近更新 更多