Since you don't issue a ticket when the balance is zero, why isn't it
sum(payments) - count(tickets)*price
? ? ? ?

(You do have an odd db design with both payments and ticket issues in the same table . . . . )