【问题标题】:Problems in SuitePay payment gatewaySuitePay 支付网关中的问题
【发布时间】:2016-03-25 21:07:15
【问题描述】:

我在我的网站中集成了SuitePay 付款方式。但是我的代码有问题。我正在使用代码SuitePay 发送给我。这是代码。此代码用于测试模式。当我使用测试信用卡详细信息时,它没有显示任何内容。

<?php

echo "<pre>";

 if(isset($_POST))
 {
  date_default_timezone_set('America/New_York');

  $login = "kecFMyP5hWV";
  $api_public_key = "7ckSM61sLitczpgAiMV6yzX4BKH6tdRq";
  $devid = "0720be9f77c28aeebae29032185e1927348c37e1";
  $mid = "99";   // this changes to live mid after testing period

  $creditcard =$_POST['creditcard'];
  $month = $_POST['month'];  // MM

  $year = $_POST['year'];     // YY - remeber 2 digits
  $cvv = $_POST['cvv'];
  $amount = $_POST['amount'];
  $ch_name=$_POST['ch_name'];
  $opt = "";

  $data = array (
   'user_login' => $login,
   'public_key' => $api_public_key,
   'developerid' => $devid,
   'transaction_data' => array (
                   'mid' => $mid,
                   'creditcard' => $creditcard,
                   'cardfullname' => $ch_name,
                   'cvv' => $cvv,
                   'currency' => 'USD',
                   'month' => $month,
                   'year' => $year,
                   'orderid' => '01234567890TEST25',    /// must be a unique number each time a sale is done
                   'amount' => $amount
           )
  );

  $json_data = json_encode($data);
  //var_dump($json_data);
  $curlURL = "https://qa.suitepay.com/api/v2/card/sale/";    // qa.suitepay.com for testing and api.suitepay.com for the live

  $ch = curl_init($curlURL);
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
  curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

  //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  //curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
  //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

  //curl_setopt($ch, CURLOPT_SSLVERSION, 4);
  //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  //curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');

  $response = curl_exec($ch);
  $arresult = json_decode($response,true);
  //print_r (curl_errno($ch));

  if(curl_errno($ch))
  {
   echo 'curl errno:'
         var_dump(curl_errno($ch));
      echo 'curl error:'
      var_dump(curl_error($ch));
  }

  curl_close($ch);
  echo 'response:'
  var_dump($response);

 }

echo "</pre>";

?> 

【问题讨论】:

    标签: php payment gateway


    【解决方案1】:

    @Ashwini Sharma:这可能是 tls 问题。您必须使用 TLSv1.2 来满足您连接的服务器的正确要求,该服务器是 suitepay。只需添加

     curl_setopt($ch, CURLOPT_SSLVERSION, 6); 
    

    之前

    $response = curl_exec($ch); 
    

    这里 6 用于 TLSv1.2。添加的行将强制服务器使用 TLSv1.2 与 suitepay 服务器连接。

    【讨论】:

      【解决方案2】:
      <?php  if(isset($_POST['submit']))
          {
      
          //print_r($_POST); die();          date_default_timezone_set('America/New_York');
           $login = "Re3WEyvhbrZ";   $api_public_key =    "4EzLWmvjKMcBgjgKniv6CnRHbAq3rEw5";   $devid =   
      "3206d2aa76e1be0e61c83420a31a03b27a953a18";   $mid = "240001";   // 
      this changes to live mid after testing period
           $creditcard =$_POST['card_number'];   $month =    $_POST['exp_date_month'];  // MM
           $year = $_POST['exp_date_year'];     // YY - remeber 2 digits      $cvv = $_POST['cvv2'];   $amount = $_POST['amountpay'];     
      $ch_name=$_POST['card_name'];       $address=$_POST['address'];
          $country=$_POST['country'];     $city=$_POST['city'];
          $state=$_POST['state'];     $zip=$_POST['zip'];
          $phone=$_POST['phone'];     $email=$_POST['email'];
          $fname=$_POST['fname'];     $lname=$_POST['lname'];
          $ipadderss=$_SERVER['REMOTE_ADDR'];;
      
           $data = array (    "user_login" => $login,    "public_key" =>    $api_public_key,    "developerid" => $devid,    "transaction_data"
      =>    array (
                        "mid" => $mid,
                        "creditcard" => $creditcard,
                        "cardfullname" => $ch_name,
                        "cvv" => $cvv,
                        "currency" => "USD",
                        "month" => $month,
                        "year" => $year,
                        "orderid" => rand(),    /// must be a unique number each time a sale is done
                          "ipaddress" => $ipadderss,
                          "bcountry" => $country,
                          "baddress" => $address,
                           "bcity" => $city,
                           "bstate" => $state,
                           "bzip" => $zip,
                         "cphone" => $phone,
                        "cfirstname" => $fname,
                         "clastname" => $lname,
                          "cemail" => $email,
                        "amount" => $amount
                )   );
           $json_data = json_encode($data);   //var_dump($json_data);      $curlURL = "https://qa.suitepay.com/api/v2/card/sale";    //   
      qa.suitepay.com for testing and api.suitepay.com for the live      
      $curl = curl_init();    curl_setopt($curl, CURLOPT_URL, $curlURL);
          curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");   curl_setopt($ch,
      CURLOPT_SSLVERSION,    6);  //curl_setopt($curl,
      CURLOPT_SSL_VERIFYHOST, 0);
          //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);    curl_setopt($curl,
      CURLOPT_POST, 1);    curl_setopt($curl, CURLOPT_POSTFIELDS,
      $json_data);
             //curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;    //curl_setopt($curl, CURLOPT_SSLVERSION,3);    //curl_setopt($curl,
      CURLOPT_SSL_VERIFYPEER, FALSE);    //curl_setopt($curl,
      CURLOPT_SSL_VERIFYHOST, 2);    // curl_setopt($curl, CURLOPT_HEADER,
      true);  //This option returns some    data to the screen    //
      curl_setopt($curl, CURLOPT_USERAGENT,    "Mozilla/4.0 (compatible;
      MSIE 5.01; Windows NT 5.0)");    //curl_setopt($curl,
      CURLOPT_COOKIEFILE, ''); //write cookies.  empty string to ignore.  
      //curl_setopt($curl, CURLOPT_COOKIEJAR, ''); //read cookies   
      //curl_setopt($curl, CURLOPT_VERBOSE, '1');    //curl_setopt($curl,
      CURLOPT_NOPROXY, 1); // causes POST to fail    //curl_setopt($curl,
      CURLOPT_HTTPHEADER,array("Expect:"));    //curl_setopt($curl,
      CURLOPT_FOLLOWLOCATION, true);
             $response = curl_exec($curl);     $arresult = json_decode($response,true);    // curl_close($curl);    // return  
      $response;  //$response = curl_exec($ch);    // $arresult =
      json_decode($response,true);   //print_r (curl_errno($ch));
           if(curl_errno($curl))   {    echo 'curl errno:';
              var_dump(curl_errno($curl));
      
           echo 'curl error:';
           var_dump(curl_error($curl));   }
           curl_close($curl);   echo 'response:';   var_dump($response);
          }         
      
      
      
      
             ?>
      

      【讨论】:

      猜你喜欢
      • 2011-02-25
      • 2015-03-10
      • 1970-01-01
      • 2011-09-07
      • 2018-09-11
      • 2021-09-07
      • 2012-09-03
      • 1970-01-01
      • 2011-12-30
      相关资源
      最近更新 更多