Are they supposed to write you a ticket and then you pay at local police station?
The official way is: you get a ticket by the police at the stop.
For this to happen, they first tell you the infraction and depending on the case they show proof (speeding, forgotten signal, illegal turn, etc.). Then, they hold on your licence or document available in exchange for the paper fine.
On the appointed date, you head to police station to provide the remaining documents and confirm the fine. The fine can either be paid online on the government’s website or at the indicated bank in cash.