Use get_terms
with parent
argument to get only direct children of a term. Use wp_list_pluck
to extract an array of term IDs that can be passed to a query.
$args = array(
'parent' => get_queried_object_id(),
);
$terms = get_terms( 'category', $args );
$term_ids = wp_list_pluck( $terms, 'term_id' );
Also uses get_queried_object_id
to get the ID of the current category archive.