O’DWYER, C. J.
Plaintiff sues to recover $1,628.66, balance due for goods sold and delivered between July 15 and November 9, 1911. Defendant, a foreign corporation having an office in the city of New York, pleads a set-off as a partial defense and two counterclaims.
[1] In the first counterclaim defendant alleges that it is a foreign corporation engaged in the manufacture and sale of cotton burlap bags and bagging; that on July 15, 1911, plaintiff sold and delivered to defendant 500 pounds of ink, which plaintiff warranted would match a sample theretofore furnished to plaintiff by defendant; that said ink did not match such sample, but that it was used by defendant in manufacturing bags, which were spoiled by reason of the defective quality of said ink; and that defendant was damaged by plaintiff’s breach of warranty as aforesaid in the sum of $1,174.19, for which sum defendant demands affirmative judgment. It appears from Schedule A annexed to the complaint that the 500 pounds of ink referred to above is one of the items of goods included in plaintiff’s complaint; hence defendant’s first counterclaim is “a cause of action arising out of the contract or transaction set forth in the complaint as the foundation of the plaintiff’s claim.” Code Civ. Proc. § 501, subd. 1. The second counterclaim, however, is brought to recover $1,194.60, damages arising out of the alleged breach of warranty respecting goods sold and, delivered by plaintiff to defendant, not mentioned in the complaint and forming no part of plaintiff’s claim; hence defendant’s second counterclaim is another “cause of action on contract existing at the commencement of the action.” Code Civ. Proc. § 501, subd. 2.
[2] Defendant demands judgment against the plaintiff, dismissing the complaint and for $2,870 damages. In its reply to said counterclaims plaintiff sets up two separate defenses to each counterclaim. In the first separate defense plaintiff alleges that the contract upon which the alleged cause of action in the first counterclaim is sought to be maintained was made in this state by the defendant, a foreign corporation doing business in this state without having first procured a certificate authorizing it to do business in this state, as required by section 15 of the General Corporation Law (Consol. Laws 1909, c. 23). In its second separate defense plaintiff alleges that the cause of action set forth in the first counterclaim is sought to be maintained and the recovery demanded in said answer is sought to be had by the defendant, a foreign corporation which for more than 13 months has been carrying on its business and employing part of its capital stock in this state without obtaining a receipt from the State Comptroller for the payment of the license fee required by section 181 of the Tax Law *551(Consol. Laws 1909, c. 60). The first and second separate defenses to defendant’s second counterclaim are practically identical with the corresponding defenses to the first counterclaim. Section 15 of the General Corporation Law prohibits any foreign stock corporation other than a moneyed corporation from doing business in this state without having first procured from the Secretary of State a certificate that it has complied with all the requirements of law to authorize it to do business in this state, and from maintaining any action in this state upon any contract made by it in this state unless prior to the making of such contract it shall have procured such certificate.
It has been held, however, that this section does not prevent a foreign corporation, which had been doing business in this state without such certificate and which was sued on a contract made in this state, from setting up a counterclaim and recovering thereon. Alsing v. New England Quartz Co., 66 App. Div. 473, 73 N. Y. Supp. 347 (1st Dept., 1901) affirmed without opinion in 174 N. Y. 536, 66 N. E. 1110, and cited with approval in Mahar v. Harrington Park Villa Sites, 204 N. Y. 235, 97 N. E. 587, 38 L. R. A. (N. S.) 210. This was an action against a foreign corporation which had not obtained a certificate from •the Secretary of State upon a promissory note given in payment of the purchase price of a pulverizing machine. Defendant interposed a counterclaim, alleging damages for breach of warranty. Plaintiff served a reply, alleging that defendant had not obtained the required certificate and on the trial sought to prove this latter fact. Held, that the evidence that defendant had not obtained such certificate was properly excluded for the reason that section 15 of chapter 687 of the Laws of 1892 did not prevent such -foreign corporation from interposing a counterclaim arising out of the transaction upon which the plaintiff sued, and that it had not been pleaded, nor did plaintiff attempt to prove that the license fee provided for by section 181 of chapter 908 of the Laws of 1896 had not been paid.
I hold that this case is authority against the first defense to the first counterclaim, and the demurrer thereto must be sustained, upon the ground that the first counterclaim grows out of the transaction upon which the plaintiff sues. The second alleged counterclaim does not arise out of the same transaction set forth in the complaint as the foundation of plaintiff’s claim, but out of an entirely separate and distinct sale. The Alsing Case goes no further than to say that:
“The defendant, having been brought into court and thus made to defend, should be allowed, unless there is a distinct provision to the contrary, * * * not only to defend, but also to litigate any question arising out of the transaction that has been made the basis of the plaintiff’s complaint.”
[3] Where it affirmatively appears upon the face of the complaint that a foreign corporation is doing business in this state, and that the contract sued on was made in this state, its complaint states no cause of action and is demurrable unless it also alleges compliance with section 15 of the General Corporation Law. Alpha Portland Cement Co. v. Schwartwieser, 146 App. Div. 571, 131 N. Y. Supp. 142; Acorn Brass Mfg. Co. v. Rutenberg, 147 App. Div. 533-535, 132 N. Y. Supp. *552600. In Wood & Selick v. Ball the Court of Appeals says (190 N. Y. at page 225, 83 N. E. at page 23):
“The only defect claimed to exist in the complaint in that case (Welsbach Co. v. N. G. & E. Co., 180 N. Y. 533 [72 N. E. 1152]) was the omission to allege compliance with section 15 of the General Corporation Law. The same defect exists in the complaint now before us. There is no allegation, either general or specific, that the condition precedent in the statute has been performed. Code Civ. Proc. § 533. Such an allegation is essential in order to set forth a cause of action, and the objection that the complaint does not state facts sufficient to constitute a cause of action is not waived by the failure to raise it by demurrer or answer. Id. § 499. * * * We think that compliance with section 15 of the General Corporation Law should be alleged and proved by a foreign corporation such as the plaintiff, in order to establish a cause of action in the courts of this state. The cases holding otherwise should be regarded as overruled and the conflict of authority ended.”
[4] Section 501, Code Civ. Proc., says that a counterclaim must be “a cause of action,” and the Court of Appeals in Cragin v. Lovell, 88 N. Y. 258, held that a counterclaim must be a complete cause of action existing in favor of the defendant where he asserts it. The defendant* in this action is seeking to recover an affirmative judgment upon its second counterclaim for damages for a breach of contract. In order to recover, defendant must prove a cause of action. It does not appear on the face of the counterclaim that the contract sued on was made by the defendant in this state. But if it appears on the trial that defendant is a foreign stock corporation doing business in this state, that the counterclaim does not grow out of the transaction upon which the plaintiff sued, and that the contract was made by it in this •state, as alleged in the reply, the fact of defendant’s compliance with section 15 of the General Corporation Law becomes a necessary part of its cause of action, without proof of which defendant cannot in' this court prove facts sufficient to constitute a cause of action. Hence the first separate defense to the second counterclaim is sufficient in law upon the face thereof, and the demurrer thereto should be overruled.
[5] As to the second defense to each counterclaim, section 181 of the Tax Law, so far as material, is as follows:
■ “Sec. 181. License Tax on Foreign Corporations.—Every foreign corporation, except banking corporations, fire, marine, casualty and life insurance companies, co-operative fraternal insurance companies, and building and loan associations, authorized to do business under the General Corporation Law, shall pay to the State Treasurer, for the use of the state, a license fee of one-eighth of one per centum for the privilege of exercising its corporate franchises or carrying on its business in such corporate or organized capacity in this state, to be computed upon the basis of the capital stock employed by it within this state, during the first year of carrying on its business in this state. * * * No action shall be maintained or recovery had in any of the courts in this state by such foreign corporation after thirteen-months from the time of beginning such business within the state, without obtaining’a receipt from the Comptroller for the payment of the license fee upon the capital stock employed by it within this state during the first year of carrying on its business in this state” (amended by Laws 1910, c. 340, in effect May 21, 1910).
It was indicated in Alsing Co. v. New England Quartz Co., supra, where it was held, as above stated, that a foreign corporation made a *553party to an action in our courts has the right, in addition to contesting the claim made against it, to recover upon a counterclaim based upon the same transaction, even though it had failed to comply with section 15 of the General Corporation Law; that if section 181 of the Tax Law had been 'pleaded, and failure to comply with its provi-' sions proved, no recovery on the counterclaim could have been had, owing to the language of section 181 of the Tax Law being broader than that of section 15 of the General Corporation Law; section 15 simply providing that no action shall he maintained in this state, whereas section 181 provides that no action shall he maintained or recovery had. No case has been found wherein the words “recovery had,” contained in section 181 of the Tax Law, have been construed other than the Alsing Case referred to above, wherein the language of section 181 is characterized as “more comprehensive” and the difference between the statutes is pointed out. It seems clear, however, that in order to permit the defendant to obtain an affirmative judgment upon these two counterclaims against the plaintiff for the sum of $2,-870 a recovery must be had by the defendant; and if the defendant, as alleged in the reply, comes within section 181 of the Tax Law, the statute plainly prohibits a recovery by it in any of the courts of this state. If plaintiff proves on the trial that defendant is a foreign corporation taxable under section 181, and that defendant is seeking a recovery in this court after 13 months from the time of beginning the carrying on Of its business within this state have expired, without defendant’s having obtained a receipt from the Comptroller for the payment of the license fee upon the capital stock employed by the defendant within this state during the first year of carrying on its business therein, the defendant cannot recover on its counterclaims. It follows that the second separate defense to each counterclaim is sufficient in law upon the face thereof, and the demurrer thereto should be overruled.
The demurrer to the second separate defense to the first counterclaim and to the first and second separate defenses to the second counterclaim overruled, and demurrer to the first separate defense to the first counterclaim sustained; $20 costs to abide the event.