When processing payments through Stripe, you need to account for their fees to ensure you receive the exact amount you want. The formula below calculates the total amount a customer should be charged, factoring in Stripe's fixed and percentage fees:
$$A = \frac{P + C}{1 - r}$$
where:
A is the total amount to charge the customer,
P is the principal amount (the amount you want to receive),
C is the fixed cost (e.g., $0.30 for Stripe's fee),
r is the percentage fee as a decimal (e.g., 2.9% = 0.029).
You can also calculate just the fee using:
$$F = \frac{r \times P + C}{1 - r}$$
Example Calculation
Let's say you want to receive $100 after Stripe's fees. If Stripe charges 2.9% + $0.30 per transaction, the calculation works like this:
$$A = \frac{100 + 0.30}{1 - 0.029} = \frac{100.30}{0.971} = 103.30$$
Thus, you need to charge the customer $103.30 to ensure you receive $100 after the fees.
Verifying the Calculation
To verify, calculate Stripe's fee for a $103.30 charge:
$$\text{Stripe Fee} = (103.30 \times 0.029) + 0.30 = 3.30$$
Subtracting $3.30 from $103.30 gives you exactly $100, confirming the formula's accuracy.



