2017-02-25 92 views
-1

我使用usaEpay我的移動應用程序。我使用我的朋友的服務器,沒有問題。Usaepay付款被拒,SSL版本錯誤

然後我租了一個服務器爲我自己。將後端切換到新服務器。我使用完全相同的代碼。我在我的網站上實施了快速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); 

任何幫助將過於讚賞。我的問題是什麼?

回答

0

我認爲錯誤消息說,這顯然是與支付網關的通信被拒絕或拒絕是由於不支持SSL的版本,你應該檢查你的服務器設置,並與您的朋友的服務器進行比較。順便說一句,看着你的PHP代碼,你知道mysql擴展從PHP v5.5.0開始已被棄用,並且從PHP 7中被移除了嗎?我建議你閱讀PHP The right way關於數據庫部分和php.net documentation