At any time after an order admitting him to bail, a defendant, instead of giving bail, may deposit with the clerk of the court in which he is held to answer the sum mentioned in the order; and, upon delivering to the officer in whose custody he is a certificate of the deposit, he must be discharged from custody.
Ala. Code § 15-13-40 (1975)