Where any tax imposed hereunder shall have been erroneously, illegally or unconstitutionally collected and application for the refund thereof duly made to the proper fiscal officer or officers, and such officer or officers shall have made a determination denying such refund, such determination shall be reviewable by a proceeding under Article 78 of the Civil Practice Law and Rules; provided, however, that such proceeding is instituted within 30 days after the giving of the notice of such denial, that a final determination of tax due was not previously made, and that an undertaking is filed with the proper fiscal officer or officers in such amount and with such sureties as a Justice of the Supreme Court shall approve to the effect that if such proceeding be dismissed or the tax confirmed, the petitioner will pay all costs and charges which may accrue in the prosecution of such proceeding.