Impossible to create a new WooCommerce customer using Rest API

In the documentation of WP REST User https://wordpress.org/plugins/wp-rest-user/ you have the aswer:

To perform further actions after user is registered, write and add_action:

add_action('wp_rest_user_user_register', 'user_registered');
function user_registered($user) {
    // Do Something
}

Replace “// Do Something” for the code to change the user role. Something like this (not tested):

$u = new WP_User( 3 ); //set your user ID
// Remove role
$u->remove_role( 'subscriber' );
// Add role
$u->add_role( 'customer' );