I am looking for a documentation regarding setting a coupon's used_by particular customer user_id on Woocommerce if coupon code to be added manually via REST API or from the Admin create new order endpoint. But I find no way to do it correctly. Hoping someone could point me out. Below is my code developed so far but it returned NULL.
$WC_Coupon = new WC_Coupon($request['code']);
$WC_Coupon->set_used_by( $request['customer_id'] );