In Ocarina of Time, he is part of an optional sidequest. The Happy Mask Salesman opened a shop in the Market, and Link is his first customer. Link is asked to sell a few masks to specific NPCs. His reward for completing this is access to the Mask of Truth.
In Majora's Mask, he is the first person Link meets after being turned into a Deku Scrub. The Happy Masks Salesman explains to Link what happened to his precious mask that was stolen by the Skull Kid in the forest. He then begs Link to recover the Majora's Mask within three days (he'll leave town by then), and in return, teaches him the Song of Healing which will turn Link to his former self, turning the Deku Scrub costume into a wearable mask. After you recover the Ocarina of Time and he teaches you the melody, the Happy Mask Salesman expects the mask, which Link does not have. He then goes crazy, telling Link that the mask can not be corrupted by evil, or Termina will suffer a terrible fate.