There is a difference when sending eth, is not the user who pay to transfer to another user, its the contract who will.
Check this simple contract I made to show you the difference between transfer
from a user to another inside the contract and withdraw
or deposit
eth on the contract.
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
contract contractPayable{
mapping(address => uint) balance;
event depositDone(uint amount, address indexed depositedTo);
function deposit() public payable returns (uint) {
balance[msg.sender] += msg.value;
emit depositDone(msg.value, msg.sender);
return balance[msg.sender];
}
function withdraw(uint amount) public {
require(balance[msg.sender] >= amount, "not enough balance to withdraw");
balance[msg.sender] -= amount;
payable(msg.sender).transfer(amount);
}
function getBalance() public view returns (uint){
return balance[msg.sender];
}
function transfer(address recipient, uint amount) public {
require(balance[msg.sender] >= amount, "Balance not sufficient");
require(msg.sender != recipient, "Don't transfer money to yourself");
uint previousSenderBalance = balance[msg.sender];
_transfer(msg.sender, recipient, amount);
assert(balance[msg.sender] == previousSenderBalance - amount);
}
function _transfer(address from, address to, uint amount) private {
balance[from] -= amount;
balance[to] += amount;
}
}