Melatonin has been used often in children over 6 years and found to be safe. In infants and toddlers it has been prescribed but not studied well so it would be best to avoid it in this age group.
Melatonin has been found safe for adults, but should be considered a drug supplement. Since it is a chemical of the brain, I suggest that you contact your child's doctor prior to giving your child this drug.