(2) Where the seller justifiably withholds delivery of goods because of the buyer's breach, the buyer is entitled to restitution of any amount by which the sum of his payments exceeds
(a) the amount to which the seller is entitled by virtue of terms liquidating the seller's damages in accordance with subsection (1), or
(b) in the absence of such terms, twenty percent of the value of the total performance for which the buyer is obligated under the contract or $500, whichever is smaller.
(3) The buyer's right to restitution under subsection (2) is subject to offset to the extent that the seller establishes
(a) a right to recover damages under the provisions of this article other than subsection (1), and
(b) the amount or value of any benefits received by the buyer directly or indirectly by reason of the contract.
(4) Where a seller has received payment in goods their reasonable value or the proceeds of their resale shall be treated as payments for the purposes of subsection (2); but if the seller has notice of the buyer's breach before reselling goods received in part performance, his resale is subject to the conditions laid down in this article on resale by an aggrieved seller (section 2- 706).