Payments>Invoice & Estimates>Settings>Notifications>Customer Notification:
when email or sms is sent from here, custom fields are not populating, but the same email and sms template is sent in an automation with trigger "Invoice status is Sent", the fields get populated fine.