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
(((455000 * 1.01) + 390) - 1%) - 390gives 454950.6 unless I'm missing something https://www.wolframalpha.com/input/?i=%28%28%28455000++*+1.01%29+%2B+390%29+-+1%25%29+-+390P.S. Updated post to denote that percentage fee is taken on a transaction amount plus fixed fee
– lessless Sep 08 '19 at 13:21at first - processing fee is charged and then notification fee is charged.
Given sender paid exactly 455000 at the end of the cycle receiver will get
455000 - 4550 - 390: 450060 cents.
– lessless Sep 08 '19 at 14:14(1.01 * 455000 + 390) - (1% from 455000) - 390equals exactly455000, thanks!