@WHMCS John
Yes, this way it works and send email.
But the actual problem is that when we add payment through callback file ro internal API, it does not send email neither. (as we were doing on previous update(8.1), nothing changed)
Alos, sendemail API does not work for invoices as well:
localAPI('SendEmail', [
'messagename' => 'Invoice Payment Confirmation',
'id' => $invoiceId,
'customtype' => 'invoice',
]);
This should work, but it does not.