Restrict Check-out to a specific domain email address

Hi There!

Does anyone know an app (and/or coding instructions) to restrict shopify check-out to only be permitted to specific email domains? As an example, if we are building a custom site and only want people to be able to check-out that have a @microsoft.com email address.

What would you do with all the others? Wouldn’t it be a better solution if you’d just offer a login to you store and hide everything unless the customer’s email address is '@microsoft? This would have to be developed with some custom code.

The other option is to use a B2B app like one of those: https://apps.shopify.com/partners/goldj

Can you please tell more how we can achieve this using code