How can I add store credit as a payment method?

If a customer in the shop has a store credit balance, that customer can be added to the sale, and the option to pay using store credit will be enabled in the payment screen.