
102 N.J. 125 (1986)
506 A.2d 352
AUTOMATIC MERCHANDISING COUNCIL OF NEW JERSEY, AUTOMATIC CATERING, INC., B & C VENDING, INC., CRYSTAL VENDING COMPANY, AND PARKWAY VENDING CO., INC., PLAINTIFFS-RESPONDENTS,
v.
THE TOWNSHIP OF EDISON, IN THE COUNTY OF MIDDLESEX, A MUNICIPAL CORPORATION, DEFENDANT-APPELLANT.
The Supreme Court of New Jersey.
Argued January 22, 1986.
Decided April 7, 1986.
*126 Peter A. DeSarno argued the cause for appellant.
*127 Douglas S. Brierley argued the cause for respondents (Schenck, Price, Smith & King, attorneys; Clifford W. Starrett, of counsel).
PER CURIAM.
This appeal primarily concerns the proper remedy to be invoked after a judicial determination that a municipal license fee is excessive. The trial court resolved the matter by determining the upper limit of what it found to be reasonable and directed a refund of the balance. On appeal, the Appellate Division, holding that a court should not establish a municipal fee, ordered a refund of the entire fee charged. We agree that only in the rarest of circumstances should a court set the fee schedule for a local governmental unit; however, we disagree that there must be a full refund to the licensee. Accordingly, we remand to the governing body to revise the subject licensing ordinance and to refund that portion of the fees collected that are in excess of the reasonable fees established.

I
The facts of the case are set forth in the reported opinion of the Appellate Division. Automatic Merchandising Council v. Township of Edison, 204 N.J. Super. 395 (1985). In brief, the case concerns an ordinance of the Township of Edison that sought to impose a forty dollar licensing fee for food-service vending machines. The trial court found the fee unreasonable based upon a finding that direct and indirect costs, plus a permissible revenue allowance, did not exceed $15 per machine. The court ordered a partial refund of $25 per machine, the amount in excess of the $15 figure. The Appellate Division affirmed the lower court's decision except that part providing a partial refund. It noted that "where a court invalidates a license fee ordinance as excessive it may not then set the proper fee because to do so would be an intrusion into the legislative prerogative." Id. at 405. The appellate panel remanded the case to the trial court for an order calculating the *128 sums due named plaintiffs and the members of the class, for a full refund of the fees paid.

II
The court below held, and we agree, that Edison is authorized to license these food-handling machines under the authority of N.J.S.A. 40:52-1 and -2. These statutes give municipalities general power to adopt and enforce ordinances that license and regulate certain trades and businesses, and to set licensing fees "which may be imposed for revenue." N.J.S.A. 40:52-2. Under the authority of these statutes there is no question that a municipality is not limited to the actual costs of such a regulatory program but may establish such fees for "revenue which may, at least within reasonable limits, exceed the regulatory costs." Salomon v. City of Jersey City, 12 N.J. 379, 390 (1953).
The test of reasonableness will vary according to:
(a) the effect upon the enterprise. See Gurland v. Town of Kearny, 128 N.J.L. 22, 25-26 (Sup.Ct. 1942) ($300 fee for ice-cream-vendor licenses that equaled 30% of gross sales held invalid); American Grocery Co. v. Board of Comm'rs, 124 N.J.L. 293, 296-98 (Sup.Ct. 1940), aff'd, 126 N.J.L. 367 (E. & A. 1941) (concession license fee of $500 for renting or leasing more than two concessions within market held reasonable in context of volume of business and standard of profit); Giant Tiger Corp. v. Board of Comm'rs, 122 N.J.L. 240, 243-46 (Sup.Ct. 1939) ($200 per food concession not confiscatory and thus valid in light of size and diversity of operation);
(b) fees charged in other municipalities. See Taxi's Inc. v. Borough of East Rutherford, 149 N.J. Super. 294, 300, 303 (Law Div. 1977), aff'd, 164 N.J. Super. 160 (App.Div. 1978) (comparing $5 fee imposed on taxis by Hasbrouck Heights and $50 fee in Hackensack with $500 fee for the first license and $200 fee for each additional license in East Rutherford); see also Bellington v. Township of East Windsor, 17 N.J. 558, 567-68 *129 (1955) (comparing trailer park fees in adjacent municipalities); and
(c) fees charged to similar businesses. See Gilbert v. Town of Irvington, 20 N.J. 432, 435 (1956) (comparing $100 license fee for milk-vending machine with $2.50 license fee for milk sold from a store or vehicle); Gurland v. Town of Kearny, supra, 128 N.J.L. at 23-24 (comparing license fees of other types of peddlers with ice-cream-peddler fee).
Some or all of these various factors, taken together with the actual cost of administering the subject ordinance's regulatory scheme, provide courts with a framework to determine whether the revenue aspects of the license fee are reasonable.[1]
In its petition for certification, Edison Township did not directly challenge the trial court's determination that the licensing fee unreasonably exceeded the costs of regulation, but rather limited its petition to the decision of the Appellate Division in ordering a total refund. Although we are not confined to arguments presented in the petition for certification, we decline to address the merits of the fee because of the procedural posture of the case. This case is a poor vehicle to test whether the revenue collected falls within the reasonable limits of excess over regulatory costs. Because of various discovery rulings made in the course of pretrial, defendant-municipality was unable to present all the proofs that it contends would sustain the forty-dollar fee. Food-handling machines obviously pose a genuine concern for human health. Unless temperatures are correctly maintained, food may spoil and various bacteria may become present in the food; unless the vending machines are properly sealed, external contaminants *130 may enter the machine and the product. It is difficult to quantify the nature or number of inspections warranted to assure continued public health. A good measure of discretion will have to be accorded a regulatory agency to develop a suitable program. Because of its discovery problem, this case seemed to proceed on the theory that the municipality had to prove the cost-basis of its fee schedule. Such is not the law. A municipal fee schedule has a presumption of reasonableness and will ordinarily be upheld unless competent proof is offered to overcome the presumption. Moyant v. Borough of Paramus, 30 N.J. 528, 534-35 (1959); Gilbert v. Town of Irvington, supra, 20 N.J. at 435; Bellington v. Township of East Windsor, supra, 17 N.J. at 568-69. Such proof should ordinarily encompass the variety of factors covered in our earlier decisions.
For the reasons stated, however, we decline to order this case to be retried because of its discovery mode.

III
With respect to the question of whether the excess fees should be refunded, we first note that this is not a case where the municipality exceeded its powers by imposing a licensing measure for an impermissible purpose. Salomon v. City of Jersey City, supra, 12 N.J. at 393-94; N.J. Good Humor, Inc. v. Board of Comm'rs, 124 N.J.L. 162, 167 (E. & A. 1940). Both courts below agreed and we now reiterate that a municipality possesses the authority to set license fees for revenue purposes within reasonable limits under N.J.S.A. 40:52-1 and -2.[2] The point is that this is not an illegal charge, it is an excessive charge.
*131 We have held that a claimant's "entitlement to a refund of excess fees followed naturally from the determination that these fees were illegally exacted." In Re Fees of State Bd. of Dentistry, 84 N.J. 582, 587 (1980). A limitation exists when a party voluntarily pays a fee and only later challenges it. City of Camden v. Green, 54 N.J.L. 591, 593 (E. & A. 1892). But it appears clear here that the licensees protested the discrepancy in license fees and promptly brought the matter to the attention of the Edison officials at the time the licenses were sought. In fact, petitioners had successfully challenged a previous attempt by the municipality to impose a licensing fee. Nor is there any issue of severe disruption of governmental policies, as found in Salorio v. Glaser, 93 N.J. 447, 465-67, cert. denied, 464 U.S. 993, 104 S.Ct. 486, 78 L.Ed.2d 682 (1983), or Borough of Neptune City v. Borough of Avon-by-the-Sea, 61 N.J. 296, 310-11 (1972), that would warrant denial of a refund.
Since a refund is in order, ordinarily the proper procedure is for the agency to redetermine the fees in accordance with correct principles and to refund the excess. In Re Fees of State Bd. of Dentistry, supra, 84 N.J. at 589-90; see also Public Serv. Elec. and Gas Co. v. New Jersey Dept. of Envtl. Protection, 101 N.J. 95, 112-14 (1985) (department directed to recalculate fees and credit excess above proper fee to future fees). Only in the rarest of cases, such as when an action has been pending for an extended period, may a court be required to establish the fee to bring the matter to a conclusion. White Birch Realty Corp. v. Gloucester Township Mun. Utils. Auth., 80 N.J. 165, 177 (1979) ("It is only because these actions have been pending [for seven years] that we have taken it upon ourselves * * * to prescribe and apply a formula").
We are not confronted here with any such grave necessity for judicial establishment of the fee. Accordingly, we believe the proper procedure is to direct that the municipality reenact the fee schedule for the regulatory year in question and refund the balance to the claimants. Because of the procedural *132 posture of this case, the fee will be confined to the $15 determined to be the outer limit for the relevant periods or else this litigation would be futile. To be resolved are the claims of the parties named in the trial court's judgment for the period July 1, 1981 to June 30, 1982, and the class of plaintiffs for the period July 1, 1982 to June 30, 1983.
This may appear to do in form what the trial court did in substance. But it is in better keeping with the distinct and separate roles of the courts and municipal governments. The trial court will retain jurisdiction to resolve any open questions of calculation of the amounts due after the municipality revises its fee schedule.
The judgment of the Appellate Division is affirmed in part and reversed in part.
For affirmance in part and reversal in part  Chief Justice WILENTZ and Justices CLIFFORD, HANDLER, O'HERN, GARIBALDI and STEIN  6.
Opposed  None.
NOTES
[1]  Mobile home parks would seem to have a "special impact" upon municipalities, requiring consideration of the general costs of government in providing services enjoyed by mobile home parks in evaluating the reasonableness of a licensing measure that imposes a fee. Nelson Cooney & Son, Inc. v. Township of So. Harrison, 57 N.J. 384, 395-96 (1971); Bellington v. Township of East Windsor, 17 N.J. 558, 567 (1955).
[2]  The trial court ruled that the ordinance was "arbitrary and unreasonable to the extent that it exceeds $15 per machine a year." (emphasis added). The Appellate Division affirmed that judgment "except to the extent that it implicitly sets an annual fee of $15 per machine." Automatic Merchandising Council v. Township of Edison, 204 N.J. Super. 395, 408 (1985).
