osCommerce - How to send Order Id to Authorize.NET

 

By default, your Order ID will not be passed to Authorize.Net. In order to make it available, you will need to modify "authorizenet_cc_aim.php":

nano catalog/includes/modules/payment/authorizenet_cc_aim.php 

Locate the code below:

function before_process() {
 global $HTTP_POST_VARS, $customer_id, $order, $sendto, $currency;


Paste the following code after it:

$last_order_id = tep_db_query("select * from ".TABLE_ORDERS." order by orders_id desc limit 1");
$last_inv = tep_db_fetch_array($last_order_id);
$new_order_id = $last_inv['orders_id'] + 1;

Then, locate another piece of code:

$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),
'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),
'x_version' => '3.1',
'x_delim_data' => 'TRUE',
     'x_delim_char' => ',',
     'x_encap_char' => '"',
     'x_relay_response' => 'FALSE',
     'x_first_name' => substr($order->billing['firstname'], 0, 50),
     'x_last_name' => substr($order->billing['lastname'], 0, 50),
     'x_company' => substr($order->billing['company'], 0, 50),
     'x_address' => substr($order->billing['street_address'], 0, 60),
     'x_city' => substr($order->billing['city'], 0, 40),
     'x_state' => substr($order->billing['state'], 0, 40),
     'x_zip' => substr($order->billing['postcode'], 0, 20),
     'x_country' => substr($order->billing['country']['title'], 0, 60),
     'x_phone' => substr($order->customer['telephone'], 0, 25),
     'x_cust_id' => substr($customer_id, 0, 20),

Paste after it:

 'x_invoice_num' => $new_order_id,

Run transaction, and you will see that Invoice # will be equal to Order ID.

 

Moving your apps to Amazon or Miscrosoft Clouds?

We can help you analyze your existing infrastructure, identify the cost savings we can achieve by migrating to a cloud provider. We can then execute end-to-end migration plan of your infrastructure and bringing down your TCO.

Cloud Computing

Ready for IPv6 Migration?

The Internet is running out of the equivalent of phone numbers - familiar problem, non-trivial solution.

The world has to move to IPv6, with its 128-bit addresses. But that's easier said than done.

IPv6 Migration

Are you fluent in "Linux"?

Learn Linux from a leading expert and quickly master you Linux skills.

Learn how to simplify your workflow and increase your productivity using tips and techniques of the pros.

Ideal training for Corporate IT Beginners and Advanced IT Admins alike.

Corporate Linux Training

Who's Online

We have 6 guests and no members online