If you are using Gravity Forms to collect payment for a service, sell a product, or collect donations, you know that the payment processors, such as Stripe, Square, and PayPal, all charge a fee. That fee is usually somewhere around three percent or more specifically 2.9% +.30.
Unfortunately, we can’t make the fees go away, but if you’d like to pass that fee on to your customer or donor, you can do so with a product field and a simple formula.
Requirements
Optional: Solutions to simplify this setup:
I will touch on these solutions at the end of this tutorial, but we do not use them in this demo.
Setting up Your Form
In this demonstration, instead of forcing the customer to pay the processing fees, we’re going to give them the option to choose if they will cover the processing fees.
If you prefer to force the user to cover the fee, simply skip steps one and three below.
Step 1: The Choice Field
- Add a Standard Radio Button Field
You want this field to be at the top of the checkout section, ideally above the Total field and credit card field.
Step 2: Processing Fee Calculation
Part 1:
For the first part of this step, we need to add a product field to the form. Once added you need to change the field type to Calculation:
Part 2:
Once part one is complete, you will need to add the formula below to the formula field.
( {The Product (Price):ID} + .3 ) / (1 - .029) - {The Product (Price):ID}
For this to work, you will need to switch out the {The Product (Price):ID} merge tag with your actual product field price merge tag as shown below.
Step 3: Removing the Fee
Remember that we’re giving the user the option to choose if they want to cover the processing fee or not, so we need to add conditional logic to the processing fee field for them to opt out of paying the fee.
- Click on the Processing Fee field
- Click on the Conditional Logic setting section
- Enable conditional logic
- Configure the logic based on the radio button field we set up in step one
- Save the form
Step 4: Testing the Form
Now that the form is set up and saved, you will be able to pass the processing fee along to the customer.
The best part about using this specific formula is that the outcome is a perfect price split between your original product price and the processing fee, as shown in the payment details below:
FAQs
What if you have multiple products?
You can add multiple products to the processing fee calculation formula. As demonstrated here:
What if you have Products with Quantity Fields?
You can still make this work; you will need to get a little more complex with the formula.
Let’s say you have two products with a quantity field; the formula would look like this:
( ({Product 1(Price):1.2}*{Product 1(Quantity):1.3}) + ({Product 2(Price):2.2}*{Product 2(Quantity):2.3}) + .3 ) / (1 - .029) - ( ({Product 1(Price):1.2}*{Product 1(Quantity):1.3}) + ({Product 2(Price):2.2}*{Product 2(Quantity):2.3}) )
In this calculation, you multiply the product price by the quantity and then add the total of those two fields together. The rest of the formula is the same.
I recommend you use the merge tag selector when creating your formula so that you can get the right field element. You probably noticed that the ID looks different than if you had just a standard product field.
Optional Add-Ons
In all cases, single products, multiple products, and products with quantities and options, these add-ons will simplify the calculations.
This add-on is free and only works in calculations. But it means that you do not have to add every product and product option to the formula.
This is an example of how the calculations for products with quantities would look if you used this plugin.
Take this:
( ({Product 1(Price):1.2}*{Product 1(Quantity):1.3}) + ({Product 2(Price):2.2}*{Product 2(Quantity):2.3}) + .3 ) / (1 - .029) - ( ({Product 1(Price):1.2}*{Product 1(Quantity):1.3}) + ({Product 2(Price):2.2}*{Product 2(Quantity):2.3}) )
and make it this:
({subtotal} + .3 ) / (1 - .029) - {subtotal}
I think you would agree this is much simpler.
This add-on is a bit more advanced than the one above, and it is not free. With this one, you get a few new fields that can be used in your forms:
If you’re looking for a way to extend your commerce forms, this plugin is worth looking into.
Need More Help?
If you still need help, feel free to use the comments or chat options below.
If you have an active Gravity Forms license, you can also open a support ticket here.
Thank you so much for this article! i was not sure how to accomplish this and it helped a lot. Cheers!
Hi, I would like to deduct an amount from the sub total if the sub total is above a minimum amount, I kind of understand how the calculations part works but how do I affect the changes to the stripe payment?
If you add the fee onto the donation amount, wouldn’t PayPal just charge a fee on the increased amount?
I too am wondering this. Doesn’t paypal just look at the total that comes in and charge the fee based on that? Am I missing something here?
With this formula, it should work that both the fee and donation are covered correctly. There is a screenshot in the tutorial above showing how this is handled by Stripe. I’m not a PayPal user, so have not tested this in PayPal, but the outcome should be the same.
I am using this for an event registration. It is possible for certain users to select options that would reduce their price to 0, letting them register for free. In this case, their subtotal is $0 but, due to the processing fee calculation that is added on, it still charges them a fee of $0.31. How can I remedy this? I thought the answer may lie in conditional logic somehow, but can’t figure it out since I can only select one “total” field for the payment amount in the Stripe feed setup.
Hi!
Stripe will not process a transaction that is less than $0.50 USD so you will have to hide CC field and use conditional logic on the Stripe feed so that it is not triggered.
How to prevent the transaction fee will likely depend on your form and setup. We’d be happy to see what we can do, can you export the form and send the JSON file to help @ gravityranger.com? Or you can start a chat and we can help there!
I appreciate your response. I will export and email the file. Thank you!
Thank you! We got it.
I have made some modifications to the form (check your email), adding a hidden Number field using the calculation field type and placing the {subtotal} field merge tag in the formula field.
You could also use the Gravity Wiz Copy Cat perk for this: https://gravitywiz.com/documentation/gravity-forms-copy-cat/?ref=158
You would then use that hidden Number field for conditional logic for your Total field, the convenience fee field, and the credit card field.
You will also need to add the same conditional logic to the Stripe feed that I have added to the credit card field.
Best,
Hi Chris,
I wondered how you handle the two types of Stripe fees? For us in AU and I think elsewhere Stripe has the below:
1.75% + A$0.30 for Domestic cards
2.9% + A$0.30 for International cards
I can see from your calcs. above it looks like you only do one calculation?
Any response would be greatly appreciated!
Hi Tom,
So that might be a bit tricky. Stripe determines what type of card is being used (domestic/international) but does not communicate that to Gravity Forms in any way, so there really is no way to determine which processing fee should be used. Unless you can gather that info from the user (i.e direct question, or address field) and then use conditional logic to determine which calculation/field to use/display.
Is that option doable?
Cheers I used this on a project today Chris!
Having the same issue as Tom, though being in Australia.
I wonder if you can block international cards in Stripe?
Most people use Visa or Mastercard in Australia for small business so if you can reject other cards that would work.
I think the fees are less for normal debt cards vs credit cards? which needs to be taken into account if so.
Probably have to ask the customer directly what card do you have with a drop down. A lot of logic but doable. If anyone has a work around keen to hear.
Hi James,
I wonder if you can block international cards in Stripe?
That would be a good question for Stripe, I know you can control which type of payment methods you can accept via the Stripe dashboard, but not sure about restricting the type of cards.
I think the fees are less for normal debt cards vs credit cards?
In the US I pay the same fee regardless if the card is a credit or debit card. Not sure if that is different in other countries, probably another question for Stripe, but I don’t think it’s possible via the Stripe add-on currently.
Best,
Can the Quantity: field on a Product be figured into the total? On my form, the page is letting parents order a year book — or a few year books, depending on whether they have a couple of kids in that school. It shows only the $1.35 for a single purchase — nothing changes when the Quantity is increased — I’d imagine there would be a “times” component added to the snippet?
Hey Steve,
Yes, you would need to multiple the price by the quantity. In the example above you would change it to something like:
( {Product (Price):1.2} * {Product (Quantity):1.3} + .3 ) / (1 – .029) – ( {Product (Price):1.2} * {Product (Quantity):1.3} )
Hope that helps!
Hey, do you think this fee recovery solution would work with recurring donations?
And doesn’t it require 2 different Stripe feeds, one with fees and one without?
Referencing “How to Pass Payment Transaction Fees to the Customer” by mr. technique
Hi Hannah,
You do not have to use two feeds. In the tutorial you referenced they are giving the user the option to cover the fees or not. However, you don’t technically need two feeds for that if the calculation field is conditional, it won’t be included in the form total if the conditions are not met for that field to show.
It should work for recurring donations because you are using the Form Total as the Recurring Amount in the Stripe feed settings. That will mean that every time the donation is processed the charge will include the donation amount plus the process fee amount.
– Chris
Thank you for the fast reply! Much appreciated.
Hi there, how do you do this when you have multiple products? There’s no way I can find to do the calculation off a total field…
You are right, you can not use the Total in a calculation, however you can add additional products to the formula.