The "relay/switch" could be triggered by the GPIO pins on a Raspberry Pi or similar SBC.
Search online "raspberry pi vending machine" there are hundreds of projects and dozens of guides.
If the computer has internet, it could run a LN node on the computer itself and send signal to the GPIO when the conditions are met (invoice paid). Or use an API to generate and check status of invoices on someone else's node (or remote node you control).
If the computer is offline, you can use this method to check if payment is received: