-4

I have to solve a problem with math, need help to find formula. Have to calculate to send amount to payment gateway. Let say for example I sell product with price 68000, the payment gateway have to charge the product with fee + tax (where the fee and tax must be borne by the user) so I can still get same money after tax + fee = 68000, fee is 1,50% from product and tax is 11% from the fee, calculate the money before send to payment gateway, tryng with this formula:

Case 1

68000 = a-a*1,50%-(a*1,50%*11%)  
68000 = a * (1 - 0.015 - 0.00165) 
a * (1 - 0.015 - 0.00165) = 68000
a * 0.98335 = 68000
a = 68000 / 0.98335

so i get value to payment gateway is 69151, then I can still get 10000 after all charge, let prove :

69151 * 1.50% = 1037
1037 * 11% = 114
total charge = 1037 + 114 = 1151
69151 - 1151 =  68000 (exactly 68000)

Case 2, with price of product 63000

63000 = a-a*1,50%-(a*1,50%*11%)  
63000 = a * (1 - 0.015 - 0.015 * 0.11)
a * (1 - 0.015 - 0.00165) = 63000
a * 0.98335 = 63000
a = 63000 / 0.98335
a = 64066

prove

64066 * 1.50% = 960
960 * 11% = 105
total charge = 960 + 105 = 1065
64066 - 1065 =  63001 (not exactly 63000)

please help, what can i fix from the formula ?

the problem is how much to add to the product price if you want to get the initial product price after transaction fees and taxes from the payment gateway

blinkbink
  • 89
  • 5
  • 1
    `1+n` and `1-n` are not the inverse of each other. Instead, it's `1+n` and `1 / (1+n)`. Which would be `1.0132` and `0.98697196999...`. Because of this, you should be multiplying by `1.0132` in the first part and dividing by `1.0132` in the second part. – Ouroborus Aug 12 '23 at 19:34

0 Answers0