Commerce Order Model in Gateway Event Plugin Hook I am trying to add some logic that can stop an order transaction from happening depending on values stored in the Order Model. Due to how my client wants the purchase page setup, I need to be able to do last-minute validating through the commerce/payments/pay action, which I can intervene before it happens using the onBeforeGatewayRequestSend event.

Below is a simplified version of what I'm trying to do. The issue I am having is accessing the Order Model, It looks like it isn't available in the $event parameter - which is why the below doesn't work.

craft()-&gt;on('commerce_payments.onBeforeGatewayRequestSend', function($event) {

    // This doesn't work. No 'order' param available.
    $order = $event-&gt;params['order']; 

    /* logic using $order, 
    -- set $is_valid (boolean) */;

    if(!$is_valid) {

       $transaction = $event-&gt;params['transaction'];
       $transaction-&gt;message = "This order is not yet complete.";
       $event-&gt;performAction = false;
       return $event;

    }

});


Is it at all possible to get the order model inside of this hook? Or is this just not the right place to be doing this?
You have access to the order from the transaction like this:

craft()-&gt;on('commerce_payments.onBeforeGatewayRequestSend', function($event) {

    $transaction = $event-&gt;params['transaction']; 
    $order = $transaction-&gt;order;

}