there are also some articles on the internet that you can find in google search for keyword "bitcoin" + "electrum" + "merchants". i haven't used any of them so i can't recommend any.
Like what the OP stated in his other post he would also like to send crypto payments automatically om his side. Electrum's merchant function in their document only accept payments as a business and doesn't have any documentation for them sending the payments. @OP on this part I think it will be harder to find a sample script on what you are asking since even e-commerce crypto payment processors like Bitpay and Coinbase commerce only has a function to receive payments for your business. You would need to consider the balance your wallet have, the fees you will be handling, and also the conversion of the prices in USD all of which if it will go wrong your funds will be instantly flushed.