This action was instituted to collect the contract price for the building of two pieces of concrete sidewalk in the city of Weiser. At the time the work was done there was in force in the city of Weiser an ordinance which prescribed the kind of material and the composition thereof that should be used in the construction of sidewalks, and also prescribed in detail the manner of construction, giving the specifications necessary to be observed in the construction of such walks. The contractor, who is respondent herein, after completing the work, was unable to procure a certificate from the city engineer or the city council to the effect that the walk had been satisfactorily constructed in compliance with the requirements of the city ordinance. The appellant refused to pay until such certificate was produced. This action was thereupon instituted, and the respondent contended in the trial court that he had in fact constructed the walk in substantial compliance with the requirements of the ordinance, and the jury rendered a verdict in his favor for the contract price.
The contract was oral, and there is a dispute between the parties as to one of the stipulations of the contract. The appellant contends that respondent agreed to build a walk in compliance with the requirements of the city ordinance, and in such manner that it would be accepted by the city authorities. Respondent denies that anything was said about compliance with the city ordinance. ■ As we view the matter, this conflict in the evidence is immaterial. Even if nothing was said whatever about the work being done in compliance with the city ordinance, that fact would be implied and the con*245tractor would be obliged to do his work in substantial compliance with the ordinance before he would be entitled to recover the contract price. "Where one contracts to do a piece of work and there is at the time an existing law prescribing the specifications for that kind of work and requiring that all such work be done in accordance with the statute or ordinance, as the case may be, the statute or ordinance becomes a part of the contract, and the one who undertakes to do such work impliedly agrees to do it in such a manner as to meet the requirements of law. (Lane v. P. & I. N. Ry. Co., 8 Ida. 230, 67 Pac. 656.) This is particularly so in a case where a contractor undertakes to construct sidewalks in a city, town or village in which there is in force an ordinance directing and commanding that the work be done in a certain manner and in accordance with certain specifications.
Respondent attempted to obviate this difficulty by testifying that after the difficulty arose between respondent and the city authorities over this work, the appellant told respondent to go ahead with the work and that appellant would pay for it whether the city accepted it or not. It is hardly to be supposed that a property owner would agree with anyone to pay for a sidewalk constructed in violation of the city ordinance and which is likely to be torn out any day by the city authorities. If the walk was in fact done in substantial compliance with the requirements, then the contractor had the remedy to compel the issuance of a certificate showing the acceptance of the work. The contractor was in a better position than anyone else to know whether he had used the materials required by the ordinance and performed the work in accordance therewith. If he failed to comply with the ordinance, it is his fault. If he did comply with the ordinance, he is in a most favorable position to show that fact, and he has ample remedy to compel the acceptance of his work and issuance of a certificate. On the other hand, the property owner who must pay for the work and at the same time has no part in the performance thereof and does not know the manner in which it was done, should not be put to the extra expense of procuring an approval and the acceptance *246of the work. If the city authorities become arbitrary or unreasonable or attempt to oppress some particular contractor, it is apt to work a hardship on someone. In such a case, however, the burden should fall upon the one who assumes it and also is in the best position to meet it and on whom the greater duty and obligation rests. One who holds himself out as a contractor to build sidewalks impliedly agrees to build them in conformity with the ordinance. He should therefore do his work in such a manner that he can compel the acceptance thereof in ease he has to deal with arbitrary or unfair officials. To require the property owner to accept and pay for such work without first having the approval of the city authorities places him at a disadvantage and necessitates his assuming an extra expense.
It is practically admitted that the walk was out of line, that a part of it did not conform to the requirements of the ordinance, that at least a couple of squares were cracked, and that other places were so constructed that pools of water would collect and stand on the walk. On the contrary, a part of the walk seems to have been in at least, a substantial compliance with the ordinance. It is clear to us from the record that the respondent was not entitled to recover the full contract price. . On the other hand, he should be allowed to recover for such part of the walk as will meet the requirements of the city authorities under the ordinance.
The judgment should therefore be reversed, and it is so ordered, and the cause is remanded with directions to grant a new trial; and if upon a new trial the respondent has not yet repaired or reconstructed the walk so as to meet the substantial requirements of the ordinance, there should be deducted from the contract price a sufficient sum to place the walk in condition that it will substantially comply with the specifications prescribed by the city authorities. Costs awarded in favor of appellant.
Stewart, C. J., and Sullivan, J., concur.