3

How we can calculate the Stripe.

I am using this formula to calculate Stripe Fee.

Say

amount = $100

(100 * 0.029) + 0.30 = 103.20

But On stripe it is displaying 103.29 instead of 103.20.

Don't know what's going on??

TheGameiswar
  • 27,855
  • 8
  • 56
  • 94
sher bahadur
  • 409
  • 1
  • 5
  • 7

3 Answers3

19

Stripe's pricing depends on the region, and might vary according to some other factors such as whether the card is domestic or not, or the card's brand. But for US accounts, the pricing is simple: 2.9% + $0.30.

So if you create a $100.00 charge, the fee will be:

($100.00 * 2.9%) + $0.30 = $3.20.

Those $3.20 will be taken out of the $100.00, i.e. the customer will be charged $100.00 and your account's balance will be increased by $96.80 ($100.00 - $3.20).

If you want to pass the fee to the customer, then it's a bit more complicated, but this article explains the math you need to apply.

In this case, if you want to receive $100.00, you'd compute the charge's amount like this:

($100.00 + $0.30) / (1 - 2.9%) = $100.30 / 0.971 = $103.30.

So you'd charge $103.30 to your customer. Stripe's fee will be $3.30 ($103.30 * 2.9% + $0.30 = $3.30), and your account's balance will be increased by $100.00.

Ywain
  • 16,854
  • 4
  • 51
  • 67
  • 1
    many thanks for this answer and I think Stripe should include this in their documentation as well – Aashish Mar 19 '21 at 09:01
  • Thanks a lot for this explanation. This must be a part of Stripe documentation. There is so much confusion around difference in processing fee when bearer is customer vs self. – Chirag Parmar Jun 16 '23 at 12:17
3
  function calculateCCAfterFee(qty) {
  var FIXED_FEE = 0.30;
  var PERCENTAGE_FEE = 0.029;
  return Number((qty + FIXED_FEE)/(1 - PERCENTAGE_FEE)).toFixed(1);
}

For the lost js developer ...

ronnie bermejo
  • 498
  • 4
  • 10
  • this is incorrect, return value should be (qty-FIXED_FEE)/(1+ PERCENTAGE_FEE) – Cat Apr 29 '18 at 13:43
  • @Cat, no, it actually isn't, [the formula as suggested by Stripe](https://support.stripe.com/questions/passing-the-stripe-fee-on-to-customers) is `goal + fixed fee` which is what the answerer has done here. – Script47 May 04 '20 at 23:46
0

I think the correct formula is :

function calculateCCAfterFee(amount) {
        var FIXED_FEE      = 0.30;
        var PERCENTAGE_FEE = 0.029;
        var temp_fee       = amount * PERCENTAGE_FEE;
        var full_fee       = temp_fee + FIXED_FEE;
        // var full_fee     ;
        return Number(full_fee).toFixed(2); 
    }

Because this returns actual amount of fee could be reduced from the amount customer pays.

Lonare
  • 3,581
  • 1
  • 41
  • 45