How to calculate transaction surplus so it will match designated amount after fee offtake?

23 Views Asked by At

I'm facing a task to calculate how much surplus should be included in transaction, so it will match designated amount after fee offtake.

Say, sender wants recipient to get 4,550,00 cents. That transaction is a subject to 1% + 390 cents fixed fee.

Question is how much sender should pay, for recipient to receive exactly 4,550,00 cents?

I can't think about any clever solution, only brute-force approach atm :(

UPDATE: percentage fee is applied on transaction amount plus fixed fee. I.e. on 4,553,90 in this example

1

There are 1 best solutions below

3
On BEST ANSWER

The sender should send $$101\%\, \text{of} \,4,550,00+390,$$ or in other words $$1.01×4,550,00+390.$$ You can work this out.