You'll receive a ticket when you get on. You give that ticket to the toll taker when you get off. You'll pay when you get off.
I often get on the pike at Bedford. Careful pulling into the toll gate. It's narrow so I just creep in.
You'll drive over scales in the road way just before entering the tool gate. This will indicate what your toll weight class is.
From Bedford to the Gettysburg exit looks like your toll will be Class-5 Ticket Toll: $27.10. The PA turnpike is an expensive toll road and the rates are going up in a month or two.
As I stated, if it were me, I'd take the more adventurous route 30.
-Tom