Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php authorize.net中的支付网关错误_Php_Payment Gateway_Authorize.net - Fatal编程技术网

Php authorize.net中的支付网关错误

Php authorize.net中的支付网关错误,php,payment-gateway,authorize.net,Php,Payment Gateway,Authorize.net,我使用authorize.net作为我的支付网关,接受信用卡支付 代码如下 $ex=JRequest::getVar('exp2',''); $amount1=JRequest::getVar('amounttrue',''); if($amount1!="") { //echo"dsfgdsf"; $amount=$amount1; //echo $amount;die; }//echo $amount;die; $post_url = "https://test.authorize.net/

我使用authorize.net作为我的支付网关,接受信用卡支付 代码如下

$ex=JRequest::getVar('exp2','');
$amount1=JRequest::getVar('amounttrue','');
if($amount1!="")
{
//echo"dsfgdsf";
$amount=$amount1;
//echo $amount;die;
}//echo $amount;die;
$post_url = "https://test.authorize.net/gateway/transact.dll";
$amount =$_POST['amount'];
$amount =$_POST['amounttrue'];
$card_num=$_POST['ccn'];
$first_name=$_POST['firstname'];
$last_name=$_POST['lastname'];
$address1=$_POST['address1'];
$state=$_POST['state'];
$zipcode=$_POST['zipcode'];
$ccname=$_POST['ccname'];
$db=&JFactory::getDBO();
$query="select * from #__book_gateway where id=1";
$db->setQuery($query);

$result=$db->loadObjectlist();
//print_r($result);die;
foreach($result as $info)
{ $login=$info->api_user_name;
$pass=$info->api_password;//die;
}//print_r($login);die;

$post_values = array(

// the API Login ID and Transaction Key must be replaced with valid values
"x_login" => "$login",
"x_tran_key" => "$pass",
//"x_login" => "52y88ZGH9f9",
//"x_tran_key" => "5rG9j97Ce46xAZzY",
/*"x_login" => "52y88ZGH9f1",
"x_tran_key" => "5rG9j97Ce46xAZzY",*/
"x_version" => "3.1",
"x_delim_data" => "TRUE",
"x_delim_char" => "|",
"x_relay_response" => "FALSE",

"x_type" => "AUTH_CAPTURE",
"x_method" => "CC",
//"x_card_num" => "4111111111111111",
"x_card_num" => "$card_num",
//"x_exp_date" => "0115",
"x_exp_date" => "$ex",
"x_amount" =>" $amount",
//"x_amount" => "19.99",
//"x_description" => "Sample Transaction",
"x_description" =>"$ccname",

//"x_first_name" => "John",
"x_first_name" =>"$first_name",
//"x_last_name" => "Doe",
"x_last_name" => "$last_name",
//"x_address" => "1234 Street",
"x_address" => "$address1",
//"x_state" => "WA",
"x_state" =>"$state",
//"x_zip" => "98004"
"x_zip" => "$zipcode"
//"x_market_type" => "2",
// "x_cpversion" => "1.0",
// "x_device_type"=>"7"
// Additional fields can be added here as outlined in the AIM integration
// guide at: http://developer.authorize.net
);

// This section takes the input fields and converts them to the proper format
// for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4"
$post_string = "";
foreach( $post_values as $key => $value )
{ $post_string .= "$key=" . urlencode( $value ) . "&"; }
$post_string = rtrim( $post_string, "& " );

// The following section provides an example of how to add line item details to
// the post string. Because line items may consist of multiple values with the
// same key/name, they cannot be simply added into the above array.
//
// This section is commented out by default.
/*
$line_items = array(
"item1<|>golf balls<|><|>2<|>18.95<|>Y",
"item2<|>golf bag<|>Wilson golf carry bag, red<|>1<|>39.99<|>Y",
"item3<|>book<|>Golf for Dummies<|>1<|>21.99<|>Y");

foreach( $line_items as $value )
{ $post_string .= "&x_line_item=" . urlencode( $value ); }
*/

// This sample code uses the CURL library for php to establish a connection,
// submit the post, and record the response.
// If you receive an error, you may want to ensure that you have the curl
// library enabled in your php configuration
$request = curl_init($post_url); // initiate curl object
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.
$post_response = curl_exec($request); // execute curl post and store results in $post_response
//print_r($post_response); die;
// additional options may be required depending upon your server configuration
// you can find documentation on curl options at http://www.php.net/curl_setopt
curl_close ($request); // close curl object

$response_array = explode($post_values["x_delim_char"],$post_response);
print_r($response_array);die;

但是上面的代码给出了错误,无法接受来自此市场类型的付款。我已浏览网络,但未获得解决方案。

您注册了哪种类型的authorize.net帐户?零售还是电子商务


零售账户要求在交易过程中有卡

您看到此错误是因为您无意中注册了零售账户而不是无卡账户。若要解决此问题,请重新注册一个不存在信用卡的帐户,或让他们为您更改帐户类型。

我想要一个ecom帐户,但我不确定我注册了哪种帐户。请告诉我注册ecom帐户的链接。因为我只希望用户通过输入其信用卡信息进行支付。请帮助。我使用了下面是注册测试帐户的链接