To anyone running into issues with Trying to quickly integrate authorize.net into their pay system or website. Below is the code I used to built/customized to get this to work. The framework is not needed unless you are creating a fully integrated system, which is not clearly indicated on the site. You are obviously going to have to expand on this code further, but this should be what anyone needs to integrate into authorize quickly.
$params = array(
'x_invoice_num' => 'test',
'x_amount' => '5',
'x_exp_date' => '1202',
'x_address' => 'test',
'x_zip' => '12345',
'x_first_name' => 'test',
'x_last_name' => 'test',
'x_relay_response' => false,
'x_type' => 'AUTH_CAPTURE',
'x_method' => 'CC',
'x_login' => 'yourlogin code goes here',
'x_tran_key' => 'your trans key goes here',
'x_card_num' => '4111111111111111',
'x_card_code' => '143',
'x_delim_data' => true,
'x_delim_char' => '|',
'x_relay_response' => false
);
$postString = '';
foreach ($params as $key => $value)
$postString .= $key.'='.urlencode($value).'&';
$postString = trim($postString, '&');
$url = 'https://secure.authorize.net/gateway/transact.dll';
$request = curl_init($url);
curl_setopt($request, CURLOPT_HEADER, 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $postString);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($request, CURLOPT_SSL_VERIFYHOST, false);
$postResponse = curl_exec($request);
curl_close($request);
print_r($postResponse);
$response = explode('|', $postResponse);
if (!isset($response[7]) || !isset($response[3]) || !isset($response[9]))
{
$msg = 'Authorize.net returned a malformed response for cart';
if (isset($response[7]))
$msg .= ' '.(int)$response[7];
die('Authorize.net returned a malformed response, aborted.');
}
$message = $response[3];
switch ($response[0])
{
case 1:
print_r($response[1]);
break ;
case 4:
print_r($response[4]);
break ;
default:
echo $message;
exit;
}