Code working in functions.php but not pluign for gavity forms

Put the add_filter() call in the init function:

public function init(){
    parent::init();
    add_filter("gform_submit_button", array($this, "form_submit_button"), 10, 2);
    add_filter("gform_confirmation", array( $this, 'custom_confirmation' ), 10, 4 );
}

And then add your custom_confirmation() function as a method to the class:

class GFSimpleAddOn extends GFAddOn {

    /* all the other properties and methods */

    public function custom_confirmation($confirmation, $form, $lead, $ajax){
        $gfe = $lead['id'];
        // rest of your code
    }

}

error code: 523