Get param from shortcode in plugin function

If you have this shortcode:

[product id="2"]

Which is redered by this:

add_shortcode( 'product', 'getSingleProduct' );
function getSingleProduct( $atts ) {
    shortcode_atts( [
      'id' => '0',
    ], $atts  );

    // Do someting with the "2".
    do_request( 'GET', get_api_url() . 'api/product/' . "2" ); // This "2" comes from the shortcode
}

You can get the shortcode params like this:

add_shortcode( 'product', 'getSingleProduct' );
function getSingleProduct( $atts ) {
    // $atts is an array with the shortcode params
    // shortcode_atts() function fills the array with the
    // default values if they are missing
    $atts = shortcode_atts( [
      'id' => '0',
    ], $atts  );

    $id = $atts['id'];

    do_request( 'GET', get_api_url() . 'api/product/' . $id );

}