You are currently using an anonymous function. The first step would be changing it to a named function so you can retrieve it from the wp_filter
global array, which holds all the registered actions and filters. You’d do it like this:
function payment_test($form, $entry_id){
if ( function_exists( 'gf_webhooks' ) ) {
$entry = GFAPI::get_entry( $entry_id );
gf_webhooks()->maybe_process_feed( $entry, $form );
gf_feed_processor()->save()->dispatch();
}
}
add_action( 'gform_post_payment_completed', 'payment_test', 10, 2 );
// Call it manually by getting the callable from the wp_filter global.
global $wp_filter;
call_user_func_array(
$wp_filter['gform_post_payment_completed']->callbacks[10]['payment_test']['function'],
$args // You have to manually provide the arguments as an array.
);