News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Run custom code after external payment

Started by vmfyelloq19, July 27, 2025, 17:59:24 PM

Previous topic - Next topic

vmfyelloq19

Friends,

I need to run some custom code after a payment has been made via an external payment gateway.
The plgVmConfirmedOrder() event is fired before payment has been made and has no payment information.

What event is triggered after a payment has been made?

Thanks in advance!

PRO

in the authorize.net plugin

its in here.
function plgVmConfirmedOrder(VirtueMartCart $cart, $order)

BUT!!! When a payment is successful ($this->approved is true), this section is executed:
if ($this->approved) {
   $this->_clearAuthorizeNetSession();
   $new_status = $this->_currentMethod->payment_approved_status;
}

Then VirtueMart's order status is updated and the order is finalized with:
$modelOrder = VmModel::getModel('orders');
$order['order_status'] = $new_status;
$order['customer_notified'] = 1;
$order['comments'] = '';
$modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, TRUE);



 This line is effectively the "trigger":

$modelOrder->updateStatusForOneOrder(...);

vmfyelloq19

Hello PRO,

thank you for your reply.

authorize.net is the actual payment plugin so $this in plgVmConfirmedOrder() obviously contains payment details.

The hint to updateStatusForOneOrder() probalbly was very helpful: as far as I understand VM's model/order.php updateStatusForOneOrder() does fire plgVmOnUpdateOrderPayment(), so that would be the event to subscribe to?