What if you don't have money to pay a lawyer during bankruptcy?
Obviously, this is not an uncommon problem. And there are many different solutions used in different circumstances.
How much and how the attorney will be paid is something to be discussed during the first meeting (which is normally done and should be specified as free), before he agrees to represent you.
At the very least, if he cannot suggest anyway you can afford him, he should have recommendations on where you can find affordable or free representation.