Bitcoin core - Listtransactions doesn't show fee of received transactions I'm using bitcoin core full node on ubuntu. When I call listtransactions some transactions coming up with no fee key.

  [8] =&gt; Array
    (
        [account] =&gt; 
        [address] =&gt; 1MTLEprpnQwLHMeYh51CQrCWxSuZPGSZ6T
        [category] =&gt; send
        [amount] =&gt; -0.0028107
        [vout] =&gt; 0
        [fee] =&gt; -1.13E-5
        [confirmations] =&gt; 0
        [trusted] =&gt; 1
        [txid] =&gt; 6c74d8ac3b9b57184ed5dff72d48474c5ecf8dac4ec9388cb0ff33bf8e3bfcbc
        [walletconflicts] =&gt; Array
            (
            )

        [time] =&gt; 1511008107
        [timereceived] =&gt; 1511008107
        [bip125-replaceable] =&gt; no
        [abandoned] =&gt; 
    )

[9] =&gt; Array
    (
        [account] =&gt; 
        [address] =&gt; 12zJ7ZbDW59mmNBPrxBAEjtWf8JzwgLNum
        [category] =&gt; receive
        [amount] =&gt; 0.00240164
        [label] =&gt; 
        [vout] =&gt; 0
        [confirmations] =&gt; 0
        [trusted] =&gt; 
        [txid] =&gt; 25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe
        [walletconflicts] =&gt; Array
            (
            )

        [time] =&gt; 1511010977
        [timereceived] =&gt; 1511010977
        [bip125-replaceable] =&gt; no
    )


)

Transaction on blockchain: https://blockchain.info/tx/25d0812c7dcf3c938430dc5c61566b8346b6e6d300b1e3cd3fc7d4031eb93cbe

I have read that just now on bitcoin.org,


  If sending payment, the fee paid as a negative bitcoins value. May be
  0. Not returned if receiving payment or for move category payments


Which answers my question, but now i'm wondering how to get the fee of received transaction.
To find the fee of the transaction, you need to know the value of the inputs and outputs and find the difference between those two values. 

Unfortunately this is much more difficult for receiving transactions, because by default bitcoin core only holds the information for transactions which are related to your wallet, not all transactions (this can be enabled with txindex=1 argument).

What this means is that, to find the fee for a receive transaction, you can call getrawtransaction "txid" true with the txid you obtain from listtransactions. The last argument, true is set to make the output "verbose" so that it includes more information about the transaction than just the hex encoded transaction itself. It will return a JSON object with vin and vout arrays which you can iterate over. You can simply sum the output values. The trouble is finding the input values. Input values are not given in transactions, so you must look them up individually. This is a problem for receiving transactions because the transactions they spend from are usually unrelated to your wallet and thus cannot be looked up without txindex=1.