[Solved] Uncaught Error: The send transactions “from” field must be defined!

Vagif Huseyn Asks: Uncaught Error: The send transactions “from” field must be defined!
i am trying to send payments to another account but i keep getting this massage

window.addEventListener(‘load’, async () => { if (window.ethereum) { window.web3 = new Web3(ethereum); try { await ethereum.enable(); initPayButton() } catch (err) { $(‘#status’).html(‘User denied account access’, err) } } else if (window.web3) { window.web3 = new Web3(web3.currentProvider) initPayButton() } else { $(‘#status’).html(‘No Metamask (or other Web3 Provider) installed’) } })

const initPayButton = () => { $(‘.pay-button’).click(() => { // paymentAddress is where funds will be send to const paymentAddress = ‘0x5EF7395FE1de8cbCA95df3B328Db3Ffc3F7727b7’ const amountEth = ‘1’

  to: paymentAddress,
  value: web3.utils.toWei(amountEth, 'ether')
}, (err, transactionId) => {
  if  (err) {
    console.log('Payment failed', err)
    $('#status').html('Payment failed')
  } else {
    console.log('Payment successful', transactionId)
    $('#status').html('Payment successful')

}) }

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.