php - Usaepay 付款被拒绝,ssl 版本错误

标签 php ssl tls1.2 usaepay

我正在为我的移动应用程序使用 usaEpay。我用的是我 friend 的服务器,没有问题。

然后我自己租了一台服务器。将后端切换到新服务器。我正在使用完全相同的代码。我在我的网站上实现了快速 SSL。但是我无法付款。

这是错误;

Error reading from card processing gateway.
Unsupported SSL protocol version

我的php api和这个一样; https://github.com/usaepay/usaepay-php/blob/master/usaepay.php

这是我的 payOrder.php 类

require('connector.php');
include ('phpseclib/Crypt/RSA.php');
include ('usaepay/usaepay.php');


$request = json_decode($HTTP_RAW_POST_DATA, true);
$token = $request['token'];
$orderid = $request['orderid'];
$ccInfo = base64_decode($request['ccinfo']);
$address = $request['address']; 

if(strlen($out_plain) >= 25) {

    $query = "SELECT * FROM xxxx_order WHERE order_id = $orderid";
    $result = mysql_query($query);
    $order = mysql_fetch_assoc($result);
    $total = $order['order_total'];

    $creditcard = explode("||", $out_plain);
    $ccnumber = $creditcard[0];
    $cvvnumber = $creditcard[1];
    $cctype = $creditcard[2];
    $ccmonth = $creditcard[3];
    $ccyear = $creditcard[4];
    $ccdate = $ccmonth.$ccyear;
    $ccname = $creditcard[5];
    $address = explode("||", $address);
    $street = $address[0];
    $city = $address[1];
    $state = $address[2];
    $zip = $address[3];
    $name = $address[4];
    $umcommand = "cc:sale" ;
    $umkey = "mykey" ;
    $pin = "mypin";

    $tran=new umTransaction;
    $tran->key = "mytrkey";
    $tran->pin = "mypin";
    $tran->usesandbox = false;
    $tran->testmode = 0;
    $tran->command = "cc:sale";
    $tran->card = $ccnumber;
    $tran->exp = $ccdate;
    $tran->amount = $total;
    $tran->invoice = $orderid;
    $tran->cardholder = $ccname;
    $tran->street = $street;
    $tran->zip = $zip;
    $tran->description = "App sale";
    $tran->cvv2 = $cvvnumber;

    flush();

    if($tran->Process()) {
        $auth = $tran->authcode;
        $refnum = $tran->refnum;
        $response = "$auth---$refnum";
        $query = "UPDATE `mydb` SET `order_status`= 2, UMresponse =                         
        $check = false;
        $count = 0;

        do {
            $check = mysql_query($query);
            $count++;
        } while ($check == false && $count < 50);

        array_push($arr, array("status" => "success", "request" =>           "check", "order_status" => "success"));
    } else {
        $tranresult = $tran->result;
        $tranerror = $tran->error;
        $trancurl = ""; 
        if(@$tran->curlerror) $trancurl = $tran->curlerror;

        $response = "$tranresult---$tranerror---$trancurl";
        $query = "UPDATE `mydb` SET `order_status`= 4, UMresponse = '$response' WHERE order_id = $orderid";

        $check = false;
        $count = 0;

        do {
            $check = mysql_query($query);
            $count++;
        } while ($check == false && $count < 50);

        array_push($arr, array("status" => "success", "request" => "check", "order_status" => "declined"));
    }

    /*
    $hashseed = mktime ();   // mktime returns the current time in seconds since epoch.
    $hashdata = $umcommand . ":" . $pin . ":" . $total . ":" . $orderid . ":" . $hashseed ;

    $hash = md5 ( $hashdata );
    $umhash = "m/$hashseed/$hash/y";

    $fields = array(`enter code here`
        "UMkey"     => urlencode($umkey),
        "UMredir"   => urlencode("myurl"),
        "UMinvoice" => urlencode($orderid),
        "UMamount"  => urlencode($total),
        "UMname"    => urlencode($ccname),
        "UMstreet"  => urlencode($street),
        "city"      => urlencode($city),
        "City"      => urlencode($city),
        "state"     => urlencode($state),
        "State"     => urlencode($state),
        "UMzip"     => urlencode($zip),
        "cardtype"  => urlencode($cctype),
        "UMcard"    => urlencode($ccnumber),
        "UMexpir"   => urlencode($ccdate),
        "UMcommand" => urlencode("cc:sale"),
        "UMhash"    => $umhash,
        "UMechofields" => "yes",
        "OrderRef"  => $orderid
    );

    $fields_string = "";
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    rtrim($fields_string, '&');

    $url = "https://www.usaepay.com/gate.php";
    // $fields = "UMkey=".urlencode($umkey)."&UMredir=".urlencode("myurl**strong text**")."&UMinvoice=$orderid&UMamount=".urlencode($total)."&UMname=".urlencode($ccname)."&UMstreet=".urlencode($street)."&city=".urlencode($city)."&state=".urlencode($state)."&UMzip=".urlencode($zip)."&cardtype=".urlencode($cctype)."&UMcard=".urlencode($ccnumber)."&UMexpir=".urlencode($ccdate)."&UMcommand=".urlencode("cc:sale");

    // array_push($arr, array("url" => $url, "fields" => $fields_string));

    //open connection
    $ch = curl_init();

    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch,CURLOPT_POST, count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);

    //execute post
    $result = curl_exec($ch);

    if($result == true) {
        array_push($arr, array("status" => "success", "request" => "send", "msg" => "Payment request sent"));
    }
    else {
        array_push($arr, array("status" => "error", "request" => "send", "msg" => "Failed to connect to the payment system"));
    }

    //close connection
    curl_close($ch);
    */
} else {
    array_push($arr, array("status" => "error", "request" => "send", "msg" => "Decryption failure, please check fields before submission"));
} else {
    array_push($arr, array("status" => "error", "request" => "send", "msg" => "User token not verified"));
}

header('Content-Type: application/json');
echo json_encode($arr);

任何帮助将不胜感激。我的问题是什么?

最佳答案

我认为错误消息清楚地表明您与支付网关的通信被拒绝或由于不支持的 SSL 版本而被拒绝,您应该检查您的服务器设置并与您 friend 的服务器进行比较。顺便说一句,看看您的 PHP 代码,您知道 mysql 扩展自 PHP v5.5.0 以来已被弃用并且从 PHP 7 中完全删除了吗?我建议您阅读 PHP The right way关于数据库部分和 php.net documentation .

关于php - Usaepay 付款被拒绝,ssl 版本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42458380/

相关文章:

python - 如何通过 TLS 1.2 运行 django runserver

http - 发送请求时如何使用uTLS连接?

php - 正则表达式解释 : (? >[^<>]+)

php - Chrome 忽略 Firebug 中显示的 CSS 规则

ruby-on-rails - Ruby gem cucumber SSL 错误和 Gem 源代码

ssl - Firefox 中的连接部分加密 :SSL

java - NoSuchAlgorithmException : TLSv1. 2 未知协议(protocol)

PHP 正则表达式检查是否包含特定单词但不包含另一个单词

PHP MySQL 将二进制字符串保存到 BLOB 字段中无法检索二进制值

mysql - 在 Aurora AWS 无服务器 MySQL 上启用 SSL