For a compromise to be effected, the party injured shall appear before the court in which the complaint or information is filed at any time before trial and acknowledge in writing that he has received satisfaction for the injury. The court may then in its discretion, on payment of the costs and expenses incurred, order all further proceedings upon the prosecution to be stayed and the defendant to be discharged therefrom. The order and reason therefor shall be entered in the journal, and such order is a bar to another prosecution for the same crime.