Generally speaking, it is not possible, because the legal provisions of criminal cases do not allow risk agency, that is, lawyers can not agree with the parties to pay the deposit first, and then pay the fees according to the amount of commutation that lawyers help the parties win.
You can talk to a lawyer first. If he still insists on charging, then you can complain to the Law Society or the Justice Bureau, and generally there will be a good result.