There are multiple API endpoints to do this. To let them sign in with their account for verification, you would want to use the /buyer/purchases (“List a buyer’s purchases”) endpoint. To have them enter a purchase code instead, you would use /author/sale (“Look up sale by code”).
You would not include this code in the theme. Instead, you would code this implementation on your own server, and then create your own API which your theme(s) will use for license verification.
Yes, using the endpoints above it is possible. However, the screenshots you posted are incorrect. The license does not limit theme usage to one license per domain - it simply limits it to one license per end product. In some rare cases, a single end product can consist of multiple domains. In many cases, customers will also want to use the theme on a test domain. You’d best be prepared to handle these types of cases.
I posted a sample PHP script in another thread showing how to verify a purchase code: