Yes, melatonin has been thoroughly studied for both oral and topical usage. Here are some studies to check out:
The Therapeutic Potential of Melatonin: A Review of the Science
Protective Effects of Melatonin on the Skin: Future Perspectives
Melatonin and human skin aging
Local Melatoninergic System as the Protector of Skin Integrity
Use of Transdermal Melatonin Delivery to Improve Sleep Maintenance during Daytime
Percutaneous penetration of topically applied melatonin in a cream and an alcoholic solution