Zen Cart Logo
Forums / General Questions / Authorize.net SIM module not passing invoice num

Authorize.net SIM module not passing invoice num

Views: 568

Results 1 to 2 of 2
18 Mar 2016, 7:52 PM
#1
ckfs1 avatar

ckfs1

New Zenner

Join Date:
Dec 2013
Location:
Ohio
Posts:
22
Plugin Contributions:
0

Authorize.net SIM module not passing invoice num

'x_invoice_num' => ' ',

What do I put in the ' ' to allow for the invoice number to be passed.

C

18 Mar 2016, 8:04 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Authorize.net SIM module not passing invoice num

There is no invoice number generated by Zen Cart until AFTER the payment is completed. That's why it's passed blank.

But if you want to GUESS the order-number that will be assigned, you can add the following 2-part code:

  1. Above the line where the array starts ... ie: above this line $submit_data_core = array(
    Add this:
    $last_order_id = $db->Execute("select orders_id from " . TABLE_ORDERS . " order by orders_id desc limit 1");
    $new_order_id = $last_order_id->fields['orders_id'];
    $new_order_id = ($new_order_id + 1);
    // add randomized suffix to order id to produce uniqueness ... since it's unwise to submit the same order-number twice to authorize.net
    $new_order_id = (string)$new_order_id . '-' . zen_create_random_value(6, 'chars');
  1. Then change:
'x_invoice_num' => ' ',
```to:```
'x_invoice_num' => $new_order_id,
```