【发布时间】: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>";
?>
【问题讨论】: