Jump to content
Sign in to follow this  
clayton1

Authorize.net authorization number

Recommended Posts

This isn't really an add on, although when i get it working, i could make an add on out of it, but i posted it here thinking this is the group with the most OSCommerce development experience. I process orders through authorize.net. They send an authorization code back in the response to confirm the order. It is required for my orders to get filled that i have this authorization number. I created an extra field in the orders table to store the authorization number. My thinking is there will be 1 authorization number per order, so i can store it in this field for the order it corresponds to. Then i will have it for filling the orders.

 

I have successfully parsed through the authorize.net response to locate the authorization number. I have even been able to store it in a seperate text file successfully. The problem i have is how do i take this authorization number, which is found in authorizenet_cc_aim.php, and insert it into the authorization_number field i created in the orders table in the database for the current order?

 

What i really need to know is how to insert any extra fields into the orders table of the database. I don't know if i could read the authorization code from the file i store it in and then insert that into the orders table? Or if i can take it right from the response and add it to the orders table right away, i don't know how i would find the orders_id corresponding to the current order.

 

Thanks in advance for any help.

Carl

Share this post


Link to post
Share on other sites

This isn't really an add on, although when i get it working, i could make an add on out of it, but i posted it here thinking this is the group with the most OSCommerce development experience. I process orders through authorize.net. They send an authorization code back in the response to confirm the order. It is required for my orders to get filled that i have this authorization number. I created an extra field in the orders table to store the authorization number. My thinking is there will be 1 authorization number per order, so i can store it in this field for the order it corresponds to. Then i will have it for filling the orders.

 

I have successfully parsed through the authorize.net response to locate the authorization number. I have even been able to store it in a seperate text file successfully. The problem i have is how do i take this authorization number, which is found in authorizenet_cc_aim.php, and insert it into the authorization_number field i created in the orders table in the database for the current order?

 

What i really need to know is how to insert any extra fields into the orders table of the database. I don't know if i could read the authorization code from the file i store it in and then insert that into the orders table? Or if i can take it right from the response and add it to the orders table right away, i don't know how i would find the orders_id corresponding to the current order.

 

Thanks in advance for any help.

Carl

 

This is what I have done. I register a session variable called 'authorization_code' and reference this variable in checkout_process.php to store the authorization code in the DB. At the end of the file I unregister the session variable.

 

Here are the changes I made. In authorizenet_aim.php go to the following condition:

// If the response code is not 1 (approved) then redirect back to the payment page with the appropriate error message
if ($this->response[0] != '1') {
// some code
}
// Add an else statement
else{
$_SESSION["authorization_code"]=$this->response[4];
}

 

Then in checkout_process.php, add the foll statement in the $sql_data_array:

'authorization_code' => $_SESSION['authorization_code']
// add the following statement where all sesssion variables are being unregistered. You will find them at the end of the file
unset($_SESSION['authorization_code']);

 

I hope it helps. Inputs are welcome

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×