An ordinance may not be enacted and a resolution may not be adopted providing for the payment of money by the city without previous authority of law. An officer executing a document authorizing payment, making a payment or passing a voucher for a payment not authorized by law commits a misdemeanor. The officer shall, upon conviction, be sentenced to pay a fine of not more than $5,000 and to imprisonment for not more than one year.