In case of such error, if the debtor redeems by paying the sum at which the estate was set off, or if he does not redeem within a year, he may recover of the creditor the sum required to correct the error, with interest thereon from the date of the levy, in an action for money had and received.