(Disclaimer: Any links with an * is an affiliate link. Although prices are the same, Mr. Technique, Inc. earns a commission on any purchases made using the link. Read more in our privacy policy)

Gravity Forms - Passing Paypal/Stripe Transaction Fees Back to the Customer
This post was originally published on June 13, 2016, but it has been updated on March 7, 2017 to include an answer to a comment below.

How to Add the Needed Amount to cover Paypal or Stripe Fees

Both Stripe and Paypal process payments for a 2.9% + $.30 fee, and they take their fee off the top. That’s only $3.20 off of a $100 transaction, but what if you process payments of $7500 or more? Paypal or Stripe fees would then be over $200. We don’t mind the fees, but some of our clients do. Once before, a client asked us to make their online payment form pass their Paypal fee back to the customer to pay.  Gravity Forms* is one of our preferred WordPress form plugins, and this particular client’s website uses Gravity Forms with the Paypal Add-On to process their online payments. The techniques that I’m going to show you would work with the Gravity Forms Stripe Add-On as well.

We’re assuming that you have the Stripe or Paypal Gravity Form Add-On activated and configured to process payments. Showing you how to set up these payment processors with Gravity Forms is a topic for another blog post. You should know how to add pricing fields as well.

Let’s get started. Add another product field and select Calculation as the field type as seen in the screenshot below:

Gravity Forms WordPress Form Plugin Calculation Field Type Selected

It’s not checked in the above screenshot, but check the Disable quantity field. Once you select Calculation, you’ll see a formula field pop up. Select your previous product field as your merge tag. For this website, Payment Amount is the name of the previous product field.

Gravity Forms WordPress Plugin Merge Tag Selected

The merge tag will show up in the Formula text area.

Gravity Forms Formula Merge Tag in Text Area

Here’s where the magic happens. You can’t use {Payment Amount:5} * .029 + .3 to account for the transaction fees because all of the transaction fees still won’t be passed to the customer. Side note: the 5 right next to Payment Amount is the form ID, so that number will be different for you. If someone makes a $100 payment on your website, and you have the formula set to the above, the customer will be charged $103.20 ($100 + $2.90 + $.30). Stripe or Paypal will take their fees off of $103.20 (not $100). 2.9% multiplied by $103.20 plus $.30 is $3.29. Subtract $3.29 from $103.20, and you are left with $99.91 which is still less than $100 (the original amount).

In this form’s case, to account for the transaction fees, this formula needs to be used:

({Payment Amount:5} + .3) / (1 – .029)

Now if someone makes a payment for $100 on your website, the customer will be charged $103.30. 2.9% multiplied by $103.30 plus $.30 is $3.30. Subtract $3.30 from $103.30, and you’re left with $100.

Make Adding the Transaction Fees Optional

In the comments section, someone asked me if this was possible. She had found the answer in Joe Winter’s Gravity Forms blog post before I had a chance to answer, but I’m posting an answer of my own anyway. To make the transaction fee optional, you would add a checkbox field preferably before the Amount field.

Gravity Forms Checkbox Settings

Next, you’ll go to the Advanced tab of the Payment Amount field with the merge tag. Check Enable Conditional Logic. Select the transaction fee question with the checkbox that you had just created. This question only has one answer, so you can’t select another answer. Performing this step, will have the payment amount field with the transaction fees show only if the visitors checks the checkbox. Your settings should look like the screenshot below:

Gravity Forms Conditional Setting to Display Payment Field with Transaction Fee

Update your form and go to Gravity Forms’ Settings -> Paypal (or Stripe). You’ll need to add another feed so the correct payment amount can be sent to Paypal or Stripe. One feed would be used only if the visitor checked the box to cover the transaction fees. The other feed wouldn’t have any conditional logic, so it’s used if the visitor doesn’t check the box to cover the transaction fees.

Gravity Forms Paypal Feeds

See it in Action

Here’s a dummy form that we created which adds the amount needed to cover the Paypal or Stripe processing fees.

If you found this blog post useful or if you have any questions, please comment below.