The court shall hear an action brought under § 21-52-8 at a regular or special term, shall have the power to extend all time of redemption pending the determination of such action, and by its decree shall determine the amount required to redeem the lands described in plaintiff's complaint; and adjudge that upon payment of such sum, a certificate of redemption shall issue to plaintiff and the amount paid by him shall be credited upon the price paid by the purchaser at foreclosure or execution sale, and the amount required to redeem the balance of the property shall be reduced accordingly.
SDCL 21-52-10