Any person against whom any tax is levied or who may be required to pay the tax, who pays the tax prior to the tax becoming delinquent and under protest to the treasurer authorized to collect the tax, giving notice at the time of payment of the reasons for such protest may, at any time within thirty days thereafter, commence an action against such treasurer for the recovery of the tax in any court of competent jurisdiction. If the court determines that the tax was wrongfully collected, in whole or in part, for any reason going to the merits of the tax, the court shall enter judgment accordingly, and such judgment shall be paid in preference to any other claim against the county, upon the final determination of the action. A pro rata share of the money so refunded shall be charged to the state and each taxing district which may have received any part of the tax. The right of appeal shall exist for both parties as in other civil actions.
SDCL 10-27-2