Problem with add_action

Yo don’t properly call the callback function.

If you want to code on oriented object programmation, you have to create your class, and construct function with add_action…

Here more informations about it :
https://wordpress.stackexchange.com/a/48094/9716

or you do something like this (its no POO but its working as well).

add_action( 'woocommerce_subscription_status_active', 'add_subscription_course_access' ) );
function add_subscription_course_access( $order )
    {

    $products = $order->get_items();
    $customer_id = $order->get_customer_id();

    $courses_id = get_field('user-programs', 'user_'. $customer_id);
    $courses_id = str_replace("[","",$courses_id);
    $courses_id = str_replace("]","",$courses_id);
    $courses_id = explode(",",$courses_id);

    foreach ( $courses_id as $course_id ) {
        ld_update_course_access( $customer_id, $course_id );
    }
}