If money has been deposited instead of bail and at any time before the forfeiture thereof the defendant surrenders himself to the officer to whom the commitment was directed, the court must order a return of the deposit to the defendant upon producing the certificate of the officer showing the surrender.
Ala. Code § 15-13-65 (1975)