I guess your new to solidity. There might be two issues might be calling function and requirements. First let me explain payable function. When you declare a function as payable that means transation will send ethers to that function.
How to call payable function,
contractObj.sampleFunction.sendTransaction(ar1, arg2,{from: <FROM>, value:<Eth_in_wei>});
If your not calling function with eth transaction it will throw an error.Note: The constructor should be payable if you send value
And coming to your qus:
transferFrom() function will check user A has given permission for auto debit for B address with X number of tokens or not? If yes then it will deduct tokens from A and credited to B address
First user A has to call approve() function with B address and number of tokens. In approve method your directly allocating X number of tokens to B.
So you have to call approve() then, after some time or 3rd party contract will call transferFrom() method with address A, address B and Y tokes.
When you want to save storage variables in solidity you need to call sendTransaction() with {from: , gas: }, If function is payable then value key will be part.
Please refer below link's for ref:
payable() function In solidity
https://theethereum.wiki/w/index.php/ERC20_Token_Standard
https://medium.com/@jgm.orinoco/understanding-erc-20-token-contracts-a809a7310aa5
transferFrom. – Mikhail Vladimirov Apr 15 '19 at 13:53