I did it with a 3D printed cap. I only did it once, and had 2 issues.
A) My epoxy resin wasn't really clear when solid, it was a sort of yellow tone.
B) It shrunk. The top of the resin surface was a bit concave. My method: I used tape on the top of the cap, turned it upside down and poured some in. I then used a toothpick to ensure that the resin had filled the entire hole and wetted(?) the surfaces to create a flat surface against the tape. I think it solidified a bit over the entire surface from the back and crated a film across the hole, which caused the problem. THe resin against the tape solidified last, which is the opposite of what you want. The entire resin then shrunk against that film, and once the tape was removed the top surface of the resin wasn't flat but a bit concave.
Good luck to ya, should be possible if you get it right from the start or iterate a bit to create a better method than mine.