Notwithstanding any rule of criminal procedure to the contrary:
(1)
(A) Whenever the defendant is admitted to bail in a specified sum, he or she may deposit the sum with the proper city or county official in the city or county in which the trial is directed to be had and take from the official a receipt of the deposit, upon delivering which to the officer in whose custody he or she is, he or she shall be discharged.
(B) After bail has been taken, a deposit may in like manner be made of the sum mentioned in the bail bond, which shall exonerate the surety.
(2) Where money is deposited, the proper city or county official shall hold and pay the money according to the orders of the court having jurisdiction to try the offense, and he or she and his or her sureties shall be liable for the money on their official bond.
(3) Upon judgment being rendered against a defendant for fine and costs, the court rendering judgment may order any money deposited agreeably to this section to be applied to the payment thereof. This subdivision (a)(3) shall not apply to a bail bond of a bail bondsman.
(4) The mayor shall designate the city official or officials who may accept a deposit of money in lieu of bail, and the county judge shall designate the county official or officials authorized to accept a deposit of money in lieu of bail.