Also, check all places where the next payout amount is being added or summed up. Validate using the transaction ID—if it already exists in the log table for another user or has been distributed, do not sum it again.Additionally, implement insert and update,delete functionality for the payment_log table.