I recently switched to invoicing per commit (current rate being €40).
A flat fee is risky for you and charging per hour is risky for the client (and tedious for you to keep track of) — the commit is less risky because he won’t be charged for half the day you spent tracking down a stupid bug you introduced in an earlier commit or work you threw away because your understanding of the involved API was immature when you started it etc.
A flat fee is risky for you and charging per hour is risky for the client (and tedious for you to keep track of) — the commit is less risky because he won’t be charged for half the day you spent tracking down a stupid bug you introduced in an earlier commit or work you threw away because your understanding of the involved API was immature when you started it etc.