Duplicate Transaction
Transaction Types in Authorize.Net

Transaction Types in Authorize.Net

Authorize.Net is one of the leading payment gateways on the market. It almost provides all you need to process credit cards online and without a separate credit card machine.
Authorize.Net supports most virtual shopping carts, and it’s for card-not-present transactions. You can use Authorize.Net for taking orders through your website on a secure page. With your Authorize.Net account, you have access to a Virtual Terminal for processing credit card orders manually or over the phone.
In this article, I want to show you some of the most-used, and most-important transaction types that you can perform in Authorize.Net and also share a sample code in PHP.

AUTH_CAPTURE

 Use this method to send a transaction for authorization. A successful transaction will be in the batch for automatic settlement. AUTH_CAPTURE is the default transaction type, meaning if you do not specify a transaction type, the gateway will submit an AUTH_CAPTURE.

 AUTH_ONLY

 Use an AUTH_ONLY method to request an approval, without enforcing a capture of the amount. The gateway communicates with the financial institution and requests approval for the amount. However, this transaction will not be in the transactions batch for settlement. 

You must follow An AUTH_ONLY transaction with a PRIOR_AUTH_CAPTURE, or else it will fall off after a certain number of days.

 PRIOR_AUTH_CAPTURE

 To capture the amount, which was only authorized by an AUTH_ONLY transaction, you must use PRIOR_AUTH_CAPTURE. If the following requirements exist, then the gateway will accept this transaction and initiate:

 • The original transaction ID, which is the outcome of an AUTH_ONLY transaction, exists and is valid.

 • The authorized transaction was successful, and it is not yet captured.

 • If the capture amount has changed, it must be less than or equal to the originally approved amount.

A new amount is not required to commence a capture transaction. In the absence of an original amount, the gateway will capture the originally approved amount.

 The following are additional mandatory fields for PRIOR_AUTH_CAPTURE transaction:

x_version = 3.1
x_login = API login ID
x_fp_hash = the transaction fingerprint
x_fp_sequence = merchant-determined sequence value
x_fp_timestamp = timestamp to generate the fingerprint
x_trans_id = transaction ID 

VOID

 To cancel the previously approved transaction (Captured or not), use a VOID method before settlements of the batch.

VOID works on CREDIT, AUTH_CAPTURE, CAPTURE_ONLY, and AUTH_ONLY. 

VOID requirements are as follow:

 • The transaction ID of the original transaction exists.

 • The gateway recognizes the transaction referenced by the ID.

 • Batch of the transactions, which contains the transaction, is not yet settled.

 The following are additional mandatory fields for VOID transaction:

x_version = 3.1
x_login = merchant API login ID
x_fp_hash = Transaction fingerprint
x_fp_sequence = merchant-determined sequence value
x_fp_timestamp = timestamp to generate the fingerprint
x_trans_id = the transaction ID

 CREDIT

 This transaction type’s name is misleading. It is usually referred to as REFUND or RETURN in other gateways.

A CREDIT transaction indicates to the gateway that you want to credit the customer account (issue a refund). 

Your request must meet the following conditions to perform a CREDIT transaction:

 • Includes the valid transaction ID of the original transaction (AUTH_CAPTURE or PRIOR_AUTH_CAPTURE) 

 • the original transaction exists in the gateway.

 • The original transaction has been settled.

 • Transaction amount for Credit transaction is less than or equal to the original transaction amount.

 • Full credit card number or the last four digits of the card, which was in the original transaction. 

CREDIT transaction is no more than 120 days after the original transaction.

 CAPTURE_ONLY

 If you have a transaction that not yet submitted for authorization through the payment gateway, you can settle it with a CAPTURE_ONLY transaction.

CAPTURE_ONLY happens when you have a voice authorization for a transaction. You must submit an authorization code to send this request to the gateway.

Authorize.Net AUTH_CAPTURE Sample Code in PHP

$post_url = "https://secure.authorize.net/gateway/transact.dll"; // Live URL
//$post_url="https://test.authorize.net/gateway/transact.dll";//Test URL

$post_values = array(

// the API Login ID and Transaction Key must be replaced with valid values
"x_login"=> $apilogin,
"x_tran_key"=> $apitrx,
"x_version"=> "3.1",
"x_delim_data"=> "TRUE",
"x_delim_char"=> "|",
"x_relay_response"=> "FALSE",
"x_card_code"=> $ccv2,
"x_type"=> "AUTH_CAPTURE",
"x_method"=> "CC",
"x_card_num"=> $cc,
"x_exp_date"=> $ccexp,
"x_amount"=> $total_amount,
"x_description"=> $one_desription,
"x_first_name"=> $fname,
"x_last_name"=> $lname,
"x_address"=> $address1,
"x_state"=> $state,
"x_zip"=> $zipcode,
"x_city"=> $city,
"x_email"=> $email,
"x_phone"=> $phone,
"x_customer_ip"=> $cip

);


$post_string = "";
foreach( $post_values as $key => $value )
{ $post_string .= "$key=" . urlencode( $value ) . "&"; }
$post_string = rtrim( $post_string, "& " );


$request = curl_init($post_url); 
curl_setopt($request, CURLOPT_HEADER, 0); 
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); 
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); 
$post_response = curl_exec($request); 

curl_close ($request);


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

$response=$response_array[0];
$reason=$response_array[3];
$authorization=$response_array[4];
$transaction=$response_array[6];

$today = date("F j, Y, g:i a");



//Add your message for the successful payment process

if ($response == 1)
{
//Approved processing
}else
{
// Declined processing
}

Kourosh

Your Header Sidebar area is currently empty. Hurry up and add some widgets.