Joomla / ESHOP Question – how i correctly pull the sub total, vat, shipping and total value from the order totals table?

i am developing a payment gateway for Joomdonations ESHOP plugin (Joomla) which is all going well, im trying to post Sub Totals,Tax and Total to the gateway.

the sub total, shipping rate, vat and total are all stored in the ordertotals table as row values under name associated with the order_id.

im trying to get my script to call the values of specific order_ids and posting them as hidden inputs

ive tried adding a mysql query todo this but im failing miserably

this is the script I’ve put together for this can you advise on how i correctly pull the sub total, vat, shipping and total value from the order totals table?

//-------------------------------------------------------------------------------------------------------------------//
//-----------------------------This section sends the transaction  information to Monek-----------------------------//
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query  ->select('value')
        ->from('#__eshop_ordertotals')
        ->where('order_id ="' . $this->order_id . '"')
        ->where('name ="' . ('sub_total') . '"');
         $db->setQuery($query);
    $this->value = $db->loadResult();
    $this->setData('products_price', $this->value);