How to create a form that gets order number and send emails (on submission) from the Thank you page?

Say, I want to let a customer select a partner organization to donate 10% of the sales. Can I create a popup form on the “Thank You page” to :

  1. Collect the order number (automatically if possible)
  2. Select the partner organization (from a list) to make donation
  3. Upon submission, an email will be sent to me and the partner organization as confirmation

Not sure about doing it through Wix Stores checkout for the donation whilst paying for something, however there are other options for you to think about.

https://support.wix.com/en/article/setting-up-your-paypal-donate-button

https://donorbox.org/nonprofit-blog/wix-donation-button/
The above is FREE if you collect less than $1,000 in a month

Otherwise, if you can access the Orders collection and obtain the needed info from that dataset in your lightbox, then you should be able to do most things.
https://support.wix.com/en/article/corvid-working-with-the-data-api

If doing this on thank you page, then in theory you might be able to get info from the dataset and also have the donation part included in that lightbox too.

Otherwise you can use wix pay to do payments.
https://www.wix.com/corvid/reference/wix-pay.html
https://www.wix.com/corvid/reference/wix-pay-backend.html
Backend version is safer and more advisable to use.

Wix Stores api info:
https://www.wix.com/corvid/reference/wix-stores.html
https://www.wix.com/corvid/reference/wix-stores-backend.html