Usaepay付款下降,ssl版本错误

时间:2017-02-25 16:11:03

标签: php ssl tls1.2 usaepay

我正在使用 usaEpay 作为我的移动应用。我正在使用我朋友的服务器,没有问题。

然后我为自己租了一台服务器。将后端切换到新服务器。我使用完全相同的代码。我为我的网站实施了快速SSL。但我不能付款。

这是错误;

  

从卡处理网关读取时出错。
  不支持的SSL协议版本

我的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);

任何帮助都会受到过分赞赏。我的问题是什么?

1 个答案:

答案 0 :(得分:0)

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