Withdrawal for Non-payment of Fees
A lawyer and client may agree that the lawyer will act only if the lawyer’s retainer is paid in advance. However, the lawyer must confirm that agreement in writing with the client and specify a payment date. (See rule 3.6-9 of the Code of Conduct.)
Even where the lawyer and the client have entered into an agreement, the lawyer cannot withdraw from the matter when fees are not paid when they are due if the withdrawal will cause serious prejudice to the client. The lawyer may withdraw if the following conditions are met:
there is sufficient time for the client to obtain the services of another lawyer, and
the replacement lawyer has sufficient time to adequately prepare for trial.
See Code of Professional Conduct, paragraph  of the commentary to rule 3.7-3.
It is good practice to establish your right to withdraw services for non-payment in the retainer letter (see the module on Retainers). As a general caution, however, see Re A.L., 2003 ABQB 905 at paragraphs 49-51, where the court recognized a strict ethical obligation to notify a client regarding withdrawal of services, even in the face of a clear contractual right to unilaterally withdraw services.
Although Leask v. Cronin,  3 W.W.R. 152, 18 C.C.C. (3d) 315 (B.C.S.C.) suggests that the court cannot question your authority to withdraw, the Alberta Court of Appeal has held that “no counsel should ever employ [the term 'unhappy differences have arisen'] to refer to non-payment of fees. That is not a matter making it ethically impossible for [counsel] to proceed.” (R. v. Creasser, 1996 ABCA 303, leave to appeal to the S.C.C. denied (February 20, 1997), at paragraph 26).