# Refund overpayments?

**URL:** https://forum.openzeppelin.com/t/refund-overpayments/32577
**Category:** Smart Contracts
**Created:** [October 19, 2022, 12:12am UTC](https://forum.openzeppelin.com/t/refund-overpayments/32577 "2022-10-19T00:12:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MetalGearSolidity](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/metalgearsolidity/32/10495_2.png) [@MetalGearSolidity](https://forum.openzeppelin.com/u/MetalGearSolidity)
#### Post date: [October 19, 2022, 12:12am UTC](https://forum.openzeppelin.com/t/refund-overpayments/32577/1 "2022-10-19T00:12:04Z")

</div>

I am using this in a contract to refund overpayments of a payable function. fees are calculated in the line above this.

```auto
if (msg.value > fees){
            uint256 excess = msg.value - fees;
            (bool success, ) = payable(msg.sender).call{value: excess}("");
            require(success, "Failed");
        }

```

After an audit I got the following feedback.

Description  
The use of low-level calls is error-prone. Low-level calls do not check for code existence or call  
success.

Recommendation  
Avoid low-level calls. Check the call success. If the call is meant for a contract, check for code  
existence.

Any thought on this process for refunding the difference after a payable function.

---

<div class="post-metadata">

### Author: ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)
#### Post date: [October 19, 2022, 12:28am UTC](https://forum.openzeppelin.com/t/refund-overpayments/32577/2 "2022-10-19T00:28:42Z")

</div>

I think it is ok to use low-level calls, as long as you know what you are doing. And when you send eth to an address like this, maybe you should notice the risk of the reentrancy.
