Custom function for payments received

Custom function for payments received

Is there a way to get this info in a custom function when a payment is received ??.....

InvoiceID
Invoice number
Payment value
Payment Mode

????