cancel
Showing results for 
Search instead for 
Did you mean: 

Sandbox API is working in one server but not working in another server

The following code is working fine in one server but not working in the other one. There must be some server related issues. It is not working on one of my Godaddy VPS where cpanel ssl has been applied. Although the other server also having the same configuration as well.

 

<?php
$txtCardNumber="5424000000000015";
$txtcvv="786";
$txtccyear="2022";
$txtccmonth="12";
$amount="100";
$TransactionID="124421";
$itemname="Test Item";
$txtname="Tester Team prTia";
$txtAddress="SILIGURI";
$txtState="WEST BENGAL";
$txtZip="734011";

//TEST 
$post_url = "https://test.authorize.net/gateway/transact.dll";
$post_values = array(
//TEST 
"x_login"			=> "68aNR4zm",
//TEST 
"x_tran_key"		=> "4MA6Y4p7Pbh5z99x",

"x_version"			=> "3.1",
"x_delim_data"		=> "TRUE",
"x_delim_char"		=> "|",
//TEST 
"x_test_request"	=> "TRUE",
"x_relay_response"	=> "FALSE",
"x_type"			=> "AUTH_CAPTURE",
"x_method"			=> "CC",
"x_card_num"		=> $txtCardNumber,
"x_card_code"		=> $txtcvv,
"x_exp_date"		=> $txtccyear.'/'.$txtccmonth,
"x_amount"			=> $amount,
"x_invoice_num"		=> $TransactionID,
"x_description"		=> "Subscribtion of ".$itemname,
"x_first_name"		=> $txtname,
"x_last_name"		=> '',
"x_address"			=> $txtAddress,
"x_state"			=> $txtState,
"x_zip"				=> $txtZip
);
$post_string = "";
foreach( $post_values as $key => $value )
{ $post_string .= "$key=" . urlencode( $value ) . "&"; }
$post_string = rtrim( $post_string, "& " );
$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
curl_close ($request); // close curl object
print_r($request);
$response_array = explode($post_values["x_delim_char"],$post_response);
print_r($response_array);
if ($response_array[0]==1){
$statusid=4; // PAID
$PaymentStatus = 'PAID';
} else {		
$statusid=1; // INCOMPLETE
$PaymentStatus = 'INCOMPLETE';
}
$ResponseText=implode(",",$response_array);

echo "PG Final Status:- <b>".$PaymentStatus."</b>";
?>
priyampaul
Member
0 REPLIES 0