At the time of cancellation of the contract or when the tenant decides to give the possession of the property back, the landlord needs to refund the security deposit to the tenant.