Calculate Transaction Fee to Charge Buyer for Donations

Hey there! I’m building a way users can raise money through donations with the Stripe plugin. I want to create a simple option for the person donating to choose to pay the transaction fees on top of the amount they are donating, so the person receiving the money receives 100% of the amount wished to donate.

For example, if someone chooses to donate $50 and they click a checkbox to choose to pay the Stripe transaction fees (2.9% + 30cents), they would be charged $51.80 total and the charity would receive $50.00.

However, this math is a bit complicated for a simple workflow in Bubble, especially if I add in my app fees on top. Workflow-wise, how would you go about getting this total in Bubble to work properly?

Hey @runthis :wave:

That is a good question, because if you were to try to charge the amount + the fees, then that would change the amount, thus changing the fees as well. :man_facepalming: Kind of a catch 22. Hmm :thinking:

1 Like

Hey Jason! You’re totally right. I’m digging in pretty deep with the Math.js plugin and looking positive. Will report back!

1 Like

Structure it as a formula where each part is added on top of the base donation amount. Stripe works in cents, not dollars, so make sure to convert if you’re working with dollar amounts in Bubble. For example, a $10.00 donation would be 1000 cents in Stripe, not 10. Add your app’s fee by including any percentage or fixed fee you set.

You can set up flows that use custom states or group values (the “group VARs” technique) that use state data to calculate the parts that make up the total and … the total … dynamically. :slight_smile:

Hope the above makes sense.

According to ChatGPT the formula would be this. :man_shrugging:

Total Donation = (Net Donation + 0.30) / (1 - 0.029)
2 Likes

Exactly! And adding in the app fees I have for my platform attached to the donation…

Total Donation = (Net Donation + My App Fee Dollar Fee + Stripe Dollar Fee) / (1-((My App Percentage Fee + Stripe Percentage Fee)/100))

1 Like

Awesome! Glad you got it working. :raised_hands:

1 Like