If I fly from the US to Dominican Republic but I have a layover in Panama City, Panama, do I have to go through customs or just stay in the terminal and then board the flight to Dominican Republic? I figured I'd have to go through customs in both countries, but I really don't want to.
We flew Copa Air from SFO > PTY > ASU in September, with an eight-hour layover in PTY. Our luggage was checked through, and we wanted to leave the airport to take a local tour during the layover. We went through Immigration and Customs to leave airside, and then went through them again (and security, too) when arriving back at PTY for the departing flight. The process was wholly without drama in both directions — these are long layovers, and I suspect the authorities are used to this behavior.
OTOH, if you're just going to hang around airside during the layover, you won't need to go through Immigration and Customs.
And note that my answer does not address whether a particular traveler needs a visa to enter Panama. I'm a US citizen, and didn't. YMMV.