#piyushjain
1 messages · Page 1 of 1 (latest)
Hello, can you show me an example of this calculation being off?
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
Do you have the ID of a payment intent (pi_123) that you tried this on where this calculation was off?
Hi looking
So you're trying to calculate what the fees are going to be with the above math? Is that right?
yes
even i tried this as well
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
may i know which GST it should be ?
my client is in US
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
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
is sales tax fixed in US ?
No it varies by location