#piyushjain

1 messages · Page 1 of 1 (latest)

slate shoalBOT
raw warren
#

Hello, can you show me an example of this calculation being off?

uneven ibex
#

hi

#

// const multiplier = 1000;
// const desired_Amount = this.dataPayload.totalAmount * multiplier;
// const percent_component = this.numberUtility.roundToTwo(((this.stripeProcessingFees.percentageFee / 100) * multiplier));
// const base_component = Number(this.stripeProcessingFees.fixedFee) * multiplier;
// const coefficient = multiplier - percent_component;
// const amountToPay = this.numberUtility.roundToTwo((desired_Amount + base_component) / coefficient + this.stripeProcessingFees.platformFee);
// processingFee = this.numberUtility.roundToTwo(amountToPay - this.dataPayload.totalAmount);

#

i added this code

raw warren
#

Do you have the ID of a payment intent (pi_123) that you tried this on where this calculation was off?

uneven ibex
#

yes

#

i havea charge id

#

ch_3MCOvS2ckdZUx44I1OStcvTF

#

hi

#

any way you can help me

calm echo
#

Hi looking

#

So you're trying to calculate what the fees are going to be with the above math? Is that right?

calm echo
#

I think the issue might be that you are rounding in multiple places within the calculation

#

I think you need to run the entire calculation without rounding

#

And then round one time at the very end

uneven ibex
#

let platFormFee = 0.55;

return ((desired_total + fixed_fee) / (1 - percent_fee)) + platFormFee;

#

i did this as well

#

still having same issue

#

i guess issue is fixed amount and percentage amount should included GST

calm echo
#

Correct

#

You'd need to know the sales tax

uneven ibex
#

is sales tax fixed in US ?

calm echo
#

No it varies by location