I suppose this is simple, but it is making my life difficult.
I need in "Invoice Payment Confirmation" Include a value from authdata field of tblclients table.
Here I have searched and maybe something similar to this hook is the way
<?php
use WHMCS\Database\Capsule;
add_hook('EmailPreSend', 1, function($vars)
{
if (in_array($vars['messagename'], array('Invoice Payment Confirmation')))
{
$codigopay = Capsule::select(Capsule::raw('SELECT authdata FROM tblclients WHERE id = "' . $vars['relid'] . '"));
foreach ($codigopay as $v)
{
$merge_fields['code_payme'][] = $v->authdata;
}
return $merge_fields;
}
});
Thank you very much for the help.