
518 P.2d 1201 (1974)
95 Idaho 739
CONTINENTAL FOREST PRODUCTS, INC., a corporation, Plaintiff-Respondent,
v.
CHANDLER SUPPLY COMPANY, a corporation, Defendant-Appellant.
No. 11019.
Supreme Court of Idaho.
February 4, 1974.
Rehearing Denied March 7, 1974.
*1203 Robert S. Campbell, Jr., of Pugsley, Hayes, Watkiss, Campbell & Cowley, Salt Lake City, Utah and Harold Q. Noack, Jr., Boise, for defendant-appellant.
Frank E. Chalfant, Jr., Boise, for plaintiff-respondent.
*1202 BAKES, Justice.
Continental Forest Products, Inc., the plaintiff-respondent, is an Oregon corporate lumber broker. As plaintiff, it instituted this action against Chandler Supply Company, also a corporation, the defendant-appellant, seeking recovery of $10,231.45, plus interest, for two carloads of plywood allegedly sold defendant in the summer of 1969. Following trial without a jury, the court entered findings of fact and conclusions of law in favor of the plaintiff (hereinafter referred to as Continental), and entered judgment in conformity with its findings and conclusions. The defendant-appellant (hereinafter referred to as Chandler) appeals from this judgment and from the order of the trial court denying its objections to the findings of fact, conclusions of law and judgment of the court.
The appellant Chandler is a wholesale lumber distributor at Boise and has done business, both buying and selling of lumber products, with a company known as North America Millwork, Inc., of Tacoma, Washington. On June 26, 1969, Larry Williams, an employee of Chandler, phoned North America Millwork, Inc., for quotations on plywood prices, advising North America it was in the market for a carload of 1/2 inch plywood and a carload of 5/8 inch plywood. Williams spoke with Ed Barker, an employee of North America, giving him the necessary data. Later on the same day, Barker advised Williams of the quoted prices for plywood, and Williams ordered the two carloads of plywood from North America Millwork, giving Barker the Chandler purchase order numbers 3246 and 3247.
On the same day, Williams prepared two separate Chandler purchase orders covering the two carloads of plywood fixing the delivery date as two weeks or sooner, f.o.b. mill, with the quoted prices. These two purchase orders, one numbered 3246 and the other numbered 3247, were mailed by Chandler to North America Millwork on the same day.
This was Chandler's first order for plywood from North America Millwork, although it had transacted a considerable volume of other lumber business with North America Millwork between December, 1968, and July, 1969. In prior transactions when Chandler had purchased from North America, North America had sent its own written acknowledgments of Chandler's purchase orders placed with it and later had submitted invoices upon shipments being made. In this instance, North America neither confirmed nor rejected the June 26, 1969, Chandler purchase orders by written acknowledgment nor did it send its invoices to Chandler.
However, on July 2, 1969, Chandler received two acknowledgments of the orders for plywood from Continental, both dated June 27, 1969, one for a carload of 1/2 inch plywood, and the other for a carload of 5/8 inch plywood. The specifications, prices and terms for the plywood as recited in the acknowledgments were substantially the same as the orders placed by Chandler with North America on June 26. The acknowledgments also referred to the Chandler purchase orders 3246 and 3247 which had been sent to North America Millwork. It is not entirely clear how Continental received Chandler's orders sent to North America. Apparently Ed Barker left his employment with North America and commenced brokering for Continental and gave the orders to Continental.
On July 7, 1969, the Monday following the Fourth of July holiday, Earl Chandler, the president of appellant company, in his *1204 own handwriting, wrote on each duplicate copy of the acknowledgments of orders received from Continental, "Purchased from North America Millwork. Earl Chandler 7-7-69" and directed that they be mailed to Continental. Earl Chandler testified that in writing this notation he assumed that Continental was making the shipments for North America. Mrs. Hebein, Earl Chandler's secretary, testified that she mailed these copies of the acknowledgments of orders, addressed to Continental, by regular mail. Witnesses for Continental testified that even though they searched through their files for these copies of the acknowledgments, they could not be found. Chandler kept copies of these acknowledgments with his handwritten note on them, and they were introduced into evidence.
Chandler received the first carload of plywood on July 24, 1969, and received an invoice from Continental for this carload. The second carload of plywood arrived August 6, 1969, and the invoice from Continental arrived on August 15. Chandler took delivery of both of these carloads, and at no time offered to return the plywood.
The terms of the orders provided for a 2% discount if paid for within five days after arrival of the invoice. On August 11, 1969, Chandler made a check for $3,636.36 payable to both Continental and North America Millwork and returned it to North America Millwork in payment of these two carloads of plywood. In calculating the amount of the payment, Chandler first deducted the 2% discount for the two carloads of plywood and also deducted a $6,212.95 trade debt owing from North America to Chandler.[1]
North America returned Chandler's check and denied that Chandler owed it money for the shipment of plywood. Chandler sent the payment to North America a second time, but it was again returned. Through a series of letters and telephone calls Chandler attempted to induce North America to accept payment. During this time, Ed Barker (who was then acting as an independent lumber broker, having left employment with North America on June 30, 1969), sent a letter to Williams (employee of Chandler) indicating that Continental was the actual supplier of the plywood. Chandler's attempt to pay North America failed, and Chandler refused to tender payment to Continental without deducting North America's trade debt.
Not having received payment for the two carloads, Continental brought this action for the quoted price of the plywood plus interest. Continental subsequently filed its supplemental complaint alleging a second claim against Chandler on the theory of unjust enrichment on the part of Chandler and seeking as damages $10,231.45.
Appellant Chandler answered the complaint and supplemental complaint, denying that it owed Continental any money or that Continental had sold it any goods. Chandler alleged that it had a contract only with North America to whom it had tendered payment. Following trial to the court on the issues framed by the pleadings, the trial court rendered its memorandum opinion in favor of Continental. Pursuant to I.R.C.P. Rule 52, Chandler moved for reconsideration of the memorandum opinion and proposed findings, which motion the court denied. Thereafter findings of fact, conclusions of law and judgment for $11,559.93 were entered, to which appellant objected. The district court denied these objections, and this appeal was taken.
Appellant first assigned as error the trial court's failure to find that Continental's *1205 claim was subject to Chandler's right of set off against North America.
In the trial court's memorandum opinion, rendered on May 26, 1971, the court discussed the relationship between Continental and Chandler and found that "the very least we have was an implied agreement or quasi contract."
Basically the courts have recognized three types of contractual arrangements. Restatement of Contracts, § 5, comment a, at p. 7 (1932); 3 Corbin on Contracts, § 562 at p. 283 (1960). First is the express contract wherein the parties expressly agree regarding a transaction. Alexander v. O'Neil, 77 Ariz. 316, 267 P.2d 730 (1954). Secondly, there is the implied in fact contract wherein there is no express agreement but the conduct of the parties implies an agreement from which an obligation in contract exists. Clements v. Jungert, 90 Idaho 143, 408 P.2d 810 (1965). The third category is called an implied in law contract, or quasi contract. However, a contract implied in law is not a contract at all, but an obligation imposed by law for the purpose of bringing about justice and equity without reference to the intent or the agreement of the parties and, in some cases, in spite of an agreement between the parties. Hixon v. Allphin, 76 Idaho 327, 281 P.2d 1042 (1955); McShane v. Quillin, 47 Idaho 542, 277 P.2d 554 (1929); 3 Corbin on Contracts, § 561, at p. 276 (1960). It is a non-contractual obligation that is to be treated procedurally as if it were a contract, and is often referred to as quasi contract, unjust enrichment, implied in law contract or restitution. In discussing a quasi contract or an action founded on unjust enrichment, the California Supreme Court stated in Ward v. Taggart, 51 Cal.2d 736, 336 P.2d 534 (1959):
"The promise is purely fictitious and unintentional, originally implied to circumvent rigid common-law pleading. It was invoked not to deny a remedy, but to create one `for the purpose of bringing about justice without reference to the intention of the parties.' 1 Williston, Contracts (rev. ed.) p. 9; ..." 336 P.2d at 538.
Similarly, in Roberts v. Roberts, 64 Wyo. 433, 196 P.2d 361 (1948), the court stated at p. 367:
"This brings us to the question as to an implied or quasi-contract pleaded in the second cause of action. Black's Law Dictionary defines it thus:
`A quasi-contract is what was formerly known as the contract implied in law; it has no reference to the intentions or expressions of the parties. The obligation is imposed despite and frequently in frustration of their intention.'" 196 P.2d at 367.
See also, Trollope v. Koerner, 106 Ariz. 164, 470 P.2d 91 (1970), and 1 Williston on Contracts (3d Ed.), § 3A at p. 13 (1957).
In this case it is clear that there is neither an express nor an implied in fact contract since there was an express rejection by Chandler of any intention to enter into a contract with Continental as evidenced by the notation made on the acknowledgments and Chandler's subsequent attempts to pay North America Millwork for the carloads of plywood. However, we agree with the trial court that under the peculiar circumstances of this case, the third type of contract, implied in law or quasi contract, exists obligating Chandler to pay for the materials which he received. However, the problem which arises is determining the amount of recovery to which Continental is entitled.
As the essence of a contract implied in law lies in the fact that the defendant has received a benefit which it would be inequitable for him to retain, it necessarily follows that the measure of recovery in a quasi-contractual action is not the actual amount of the enrichment, but the amount of the enrichment which, as between the two parties it would be unjust for one party to retain. Hixon v. Allphin, supra; 66 Am.Jur.2d, Restitution and Implied Contracts, at p. 946 (1973); Meehan v. Cheltenham, 410 Pa. 446 189 A.2d *1206 593 (1963); Farmers National Bank of Bloomsburg v. Albertson, 203 Pa.Super. 205, 199 A.2d 486 (Pa. 1964). In the instant case we feel that the enrichment which Chandler "unjustly received" was the value of the plywood shipped less the trade set off which Chandler had against North America Millwork and which he would have been entitled to take had the transaction been completed the way Chandler had intended and attempted to complete it. Chandler had a right to deal exclusively with North America and use his trade set off as part of the purchase price. Chandler should not be deprived of this set off in view of the way that Continental became involved in this transaction.
The foregoing conclusions necessarily follow as a matter of law from the salient facts found in the record. Those facts are that Chandler had placed the orders initially with North America Millwork, knowing that he had a trade set off; that the North America Millwork employee Ed Barker left his employment with North America Millwork and apparently took the Chandler orders with him, and that the orders subsequently wound up in the Continental organization; that Continental, without notifying Chandler that Barker had terminated his employment with North America and was now brokering for Continental, mailed its acknowledgments of the two orders which Chandler had placed with North America Millwork, referring to them by Chandler purchase order numbers which were sent to North America Millwork; that Chandler wrote on those acknowledgments that he had purchased the plywood from North America Millwork and mailed the acknowledgments back to Continental; and that Chandler attempted to make payment for the plywood to North America Millwork. If any party was responsible for the situation present in this case, it was Continental. Although it is not entirely clear from the record, it would appear that Barker breached the fiduciary duty which he owed to his employer North America Millwork by taking the Chandler purchase orders to Continental. Continental then, wittingly or unwittingly, took advantage of that breach of a fiduciary relationship and filled the orders, apparently without inquiry concerning the status of North America Millwork, the existence of a trade debt, the situation behind Barker's taking the purchase orders to Continental, or notifying Chandler that it was attempting to take over the North America transactions. Under these circumstances we feel that it would not be unjust to require Chandler to pay only that amount which he would have had to pay to North America had the transaction gone the way Chandler had intended and attempted to have it go.
Since the resolution of the quasi-contractual issue is dispositive in this case it is unnecessary to become embroiled in a discussion of the presumption of receipt of a letter duly mailed versus the weight to be given to testimony on non-receipt, as did the trial court in deciding the case and as did the parties on appeal.
Judgment should be entered for Continental against Chandler in the amount of the principal claim less the amount of the North America Millwork trade debt which Chandler had. The matter should be remanded to the trial court to make the necessary computations including adjustments for interest on account.
Judgment reversed and remanded. Costs awarded to appellant.
DONALDSON and McQUADE, JJ., concur; SHEPARD, C.J., concurs in result.
McFADDEN, Justice (dissenting).
It is my conclusion that the judgment of the trial court should be affirmed, and I dissent from that portion of the majority opinion which after determining that Chandler was obligated to pay for the plywood it received, then proceeds to grant an offset to Chandler for an alleged debt owed to it by North America Millwork.
*1207 The basic reason for this dissent is that the majority opinion in effect grants to Chandler an offset for a trade debt allegedly due Chandler from North America, who is neither a party to this action, nor in privity with Continental. Stringent requirements are established for a court to recognize an offset. See, Brown v. Porter, 42 Idaho 295, 245 P. 398 (1926), which considered the provisions governing the right to a setoff, C.S. §§ 6694-6697 (I.C. §§ 5-612 to 5-615). See I.R.C.P. 13(a) and 13(b). In Petersen v. Lyders, 139 Cal. App. 303, 33 P.2d 1030, 1031 (1934), cert. den. 294 U.S. 716, 55 S.Ct. 514, 79 L.Ed. 1249, reh. den. 294 U.S. 734, 55 S.Ct. 635, 79 L.Ed. 1262, the Supreme Court of California considered statutes governing the right to setoff which were identical to Idaho's:
"It is elementary that a set-off may not be invoked unless the parties and the debts are mutual and that the doctrine of mutuality requires that the debts be due to and from the same persons in the same capacity."
Later in Advance Ind. Fin. Co. v. Western Equities, Inc., 173 Cal. App.2d 420, 343 P.2d 408 (1959), the California Supreme Court again emphasized the necessity of mutuality in setoff cases in the following language:
"A counterclaim or a setoff is defined as a cause of action in favor of the defendant on which he might have sued the plaintiff in a separate action and, in the case of a counterclaim, might have obtained affirmative relief * * *. A claim based on an equitable right may be set up as a counterclaim against a claim based on a legal right. While the doctrine of setoff, as distinguished from statutory counterclaim, is eminently an equitable one, the equitable right is founded on the idea that mutual existing indebtedness, arising out of contracts between parties to the record, creates payment of both demands so far as they equal each other. The two demands must be mutual." (Citations omitted.) 343 P.2d at 412.
See also, Cruzan v. Franklin Stores Corp., 72 N.M. 42, 380 P.2d 190 (N.M. 1963); Sarkeys v. Marlow, 205 Okl. 15, 235 P.2d 676 (1951); A.S. & R. Co. v. Swisshelm Gold Silver Co., 63 Ariz. 204, 160 P.2d 757 (Ariz. 1945).
In this case there is no record of mutuality. The alleged debt is owing from North America to Chandler, Continental has not been shown to have been connected with North America by agency, contract, or assignment, and the trial court did not find any such relationship between Continental and North America.
The majority opinion reaches its final conclusion on the basis that Chandler was going to be unjustly enriched if it was allowed to retain the plywood shipped by Continental without paying somebody. By some process the opinion places fault on the part of Continental, and then states "Under these circumstances we feel that it would not be unjust to require Chandler to pay only that amount which he would have had to pay to North America had the transaction gone the way Chandler had intended and attempted to have it go." This conclusion is then followed by a refusal of the majority opinion to consider what in my opinion is one of the crucial points of the case, i.e., whether Continental ever received the copies of the acknowledgment of orders on which Earl Chandler had written "Purchased from North America Millwork. Earl Chandler 7-7-69."
The majority opinion in faulting Continental for its activities in effect holds the trial court erred when it specifically found "the return acknowledgment with the notation by Mr. Earl Chandler was not received by Continental Forest Products." At trial both parties contested this issue and appellant assigned the issue as an error on appeal. In such cases, when there is testimony by the addressee denying receipt of the mailed instrument, an issue of fact is presented for resolution by the trier *1208 of facts. American Surety Co. v. Blake, 54 Idaho 1, 27 P.2d 972 (1933); IX Wigmore (3d ed.) § 2519; Bell, Handbook of Evidence (1972), p. 239. The trial court sat as a trier of the facts and its function was to weigh the evidence and judge the credibility of the witnesses. A conflict in the evidence as to the receipt of the acknowledgments was presented, and in light of competent, substantial, although conflicting evidence, the trial court's findings in this regard should have been considered and upheld. Ivie v. Peck, 94 Idaho 625, 495 P.2d 1110 (1972).
There are numerous other points wherein I disagree with the majority opinion, particularly in regard to what it claims the trial court found. Extended discussion of these would be futile in a dissent and would unduly lengthen it.
NOTES
[1]  During the summer of 1969 North America Millwork began experiencing financial difficulties. Eventually, in December, 1969, North America Millwork made a common law assignment of assets to its creditors in an effort to liquidate its trade obligations. Through a letter of July 17, 1969, North America Millwork advised Chandler of its financial problems. At this time there was a balance due from North America to Chandler on other transactions in the amount of $6,212.95.
