You can easily create a donation-based payments for your classes by creating single-session class pack memberships (one for each donation price) and making sure you have drop-ins on the class disabled.
When a customer registers for the class they will see all pack options available to them, and will be able choose which donation amount it is they want to purchase.
To create a pack, head to Memberships >> Memberships >> 'Add a membership' >> select pack option. Here, remember to select the applicable classes and set the pack size to "1".
To disable drop-ins, head to Classes >> Class types >> Settings & Pricing >> click 'Edit' next to Pricing.