Deal to Closed Won when Invoice Paid

Deal to Closed Won when Invoice Paid

How would I create a custom function so that when an Invoice is paid in Zoho Billing the associated deal is marked as Closed Won?