cancel
Showing results for 
Search instead for 
Did you mean: 

Posting to authorize using the transact dll method directly

I've inrehited some legacy authorized code that proccesses payments in a non-optimal way. I need to fix the script so that it issues a post request (it's currently doing get).

 

The script does not use the api and instead it just uses this url https://secure.authorize.net/gateway/transact.dll, and string building with concats to send data to authorize.net

 

for example this is what processes the payment.

 

$sPaymentURL = "https://secure.authorize.net/gateway/transact.dll?" . $sParams;

$ResponseText = file_get_contents($sPaymentURL);

 

$sParams itself is a concatenation of many vars below

 

$sParams = "x_test_request=FLASE";
$sParams .= "&x_login=" . urlencode($AUTHORIZE_LOGIN) . "&x_password=" . urlencode($AUTHORIZE_PASSWORD);
$sParams .= "&x_card_num=" . urlencode($x_Card_Num);
$sParams .= "&x_delim_data=TRUE";
$sParams .= "&x_delim_char=|";
$sParams .= "&x_relay_response=FALSE";
$sParams .= "&x_exp_date=" . urlencode($EXPIRATION_DATE);
$sParams .= "&x_invoice_num=" . urlencode($ORDER_NR);
$sParams .= "&x_amount=" . urlencode($tCAmt);
$sParams .= "&x_first_name=" . urlencode($x_first_name);
$sParams .= "&x_last_name=" . urlencode($x_last_name);
$sParams .= "&x_city=" . urlencode($x_city);
$sParams .= "&x_zip=" . urlencode($x_zip);
$sParams .= "&x_address=" . urlencode($tCCAddr1);
$sParams .= "&x_state=" . urlencode($x_state);
$sParams .= "&x_country=" . urlencode($x_country);
$sParams .= "&x_email=" . urlencode($tBEmail);
$sParams .= "&x_email_customer=FALSE";
$sParams .= "&x_email_merchant=TRUE";
$sParams .= "&x_ship_to_first_name=" . urlencode($tNameBuyer);
$sParams .= "&x_ship_to_address=" . urlencode($tShpAddr1);
$sParams .= "&x_ship_to_city=" . urlencode($x_Ship_To_City);
$sParams .= "&x_ship_to_state=" . urlencode($x_Ship_To_State);
$sParams .= "&x_ship_to_zip=" . urlencode($x_Ship_To_ZIP);
$sParams .= "&x_ship_to_country=" . urlencode($x_Ship_To_Country);

 

what I'm trying to do is use a post request like the example below, where the mData array captures all the variables I need. The problem is I'm not sure how to form the login variable

since it seems it's not an atomic value. 

 

Because login contains two parts (login_id +pasword) how do i form it in the array? as a subarray? or is there another way I can execute this post without using the api?

 

$mData = array('x_test_request' => 'FALSE', 'x_login' => $ready_x_login,
'x_card_num' => $ready_x_card_num, 'x_delim_data' => 'TRUE', 'x_delim_char' => '|',
'x_relay_response' => 'FALSE', 'x_exp_date' => $ready_x_exp_date,
'x_invoice_num' => $ready_x_invoice_num, 'x_amount' => $ready_x_amount,
'x_first_name' => $ready_x_first_name, 'x_last_name' => $ready_x_last_name,
'x_city' => $ready_x_city, 'x_zip' => $ready_x_zip, 'x_state' => $ready_x_state,
'x_country' => $ready_x_country, 'x_email' => $ready_x_email,
'x_email_customer' => 'FALSE', 'x_email_merchant' => 'TRUE',
'x_ship_to_first_name' => $ready_x_ship_to_first_name, 'x_ship_to_address' => $ready_x_ship_to_address,
'x_ship_to_city' => $ready_x_ship_to_city, 'x_ship_to_state' => $ready_x_ship_to_state,
'x_ship_to_country' => $ready_x_ship_to_country);

 

$mOptions = array(
    'http' => array(
    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
    'method' => 'POST',
    'content' => http_build_query($mData)
    )
);

 

any help will be greatly appreciated

Alix
Member
1 ACCEPTED SOLUTION

Accepted Solutions

The password is just another param.

read the AIM guide here

http://developer.authorize.net/api/upgrade_guide/

View solution in original post

RaynorC1emen7
Expert
1 REPLY 1

The password is just another param.

read the AIM guide here

http://developer.authorize.net/api/upgrade_guide/

RaynorC1emen7
Expert