plugin not sending order_id to authorize.net

  • Posts: 5
  • Thank you received: 0
12 years 6 months ago #48406

I'm using authorize.net and the order_id is not being sent.

In authorize.php, the _loadStandardVars loads $order->order_id into $vars["x_invoice_num"] if order_id is not empty. However, it appears this is called before order_id is set.

I've verified that x_invoice_num is correctly transmitted to authorize.net when order_id is set by hardcoding text into $vars["x_invoice_num"] in the _loadStandardVars function. However, I don't know where the class is called from and haven't found other code to figure out where the problem is. Any suggestions on how to make this work? Thanks!

Last edit: 12 years 6 months ago by miracell.

Please Log in or Create an account to join the conversation.

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
12 years 6 months ago #48440

If you're using the SIM API, the order_id will be sent to authorize.net

You must be using the AIM API where the payment is validated BEFORE creating the order and that's why you don't have the order_id sent to authorize.net since the order does not exist yet. So it's totally normal that it works like that.

If you really want to have the order id and use the AIM API, you will have to add some code to get the latest order id and increment it and hopefully that number will be the order id attributed to that order when it will create the order after the payment is accepted.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
12 years 6 months ago #48497

Yes, I'm using AIM and I want the order_id sent. It is very helpful for accounting to have the online order ID on both the online order and the authorize.net billing. I don't mind working on the code, so any help you can give to point me in the right direction is appreciated. Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
12 years 6 months ago #48553

You can change:

if(!empty($order->order_id)){
			$vars["x_invoice_num"] = $order->order_id;
			$vars["x_po_num"] = $vars["x_invoice_num"];
		}
to:
		if(!empty($order->order_id)){
			$vars["x_invoice_num"] = $order->order_id;
			$vars["x_po_num"] = $vars["x_invoice_num"];
		}else{
			$db =& JFactory::getDBO();
			$db->setQuery('SELECT max(order_id) FROM #__hikashop_order');
			$vars["x_invoice_num"] = $db->loadresult()+1;
			$vars["x_po_num"] = $vars["x_invoice_num"];
		}
in the plugins/hikashoppayment/authorize.php file.

The following user(s) said Thank You: miracell

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum