PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Adding paypal transaction fee

  1. Sophie
    Member

    Hello,

    Just wondering if there is a way to add the PayPal transaction calculation.

    In Australia it is 2.4% of the total amount plus $0.30 AUD.

    Is there a way to have this calculation added into the gravity form?

    Thanks!

    Posted 12 years ago on Monday June 20, 2011 | Permalink
  2. Hi Sophie,

    With the latest version of Gravity Forms (not publicly released but I can send you and anyone else who requires this functionality privately) we've added two hooks that will let you add a surcharge much more readily.

    Here is some sample code to get you started. http://pastie.org/2094896
    Paste this in your theme's functions.php file.

    This example simply adds $1.32 to the total. With a little math you can update the equation to add your flat fee + percentage.

    Posted 12 years ago on Monday June 20, 2011 | Permalink
  3. Sophie
    Member

    Great, thank you very much for that.

    I have upgraded but I don't seem to see where I then are able to do the equation.
    Do I still need to paste the php code? and if I needed it to be 2.4% of the total cost of the transaction + 0.30 AUD where/what code do I enter? I'm not very good at php.

    Thanks again :)

    Posted 12 years ago on Tuesday June 21, 2011 | Permalink
  4. The code would go in your themes functions.php file.

    You would need to know some PHP and jQuery to be able to do the equation. In the code snippet David provided you will see that it is taking the Total and adding 1.32 to it.

    Here is a revised code snippet that adds the 2.4 percentage and the .30 transaction fee.

    http://pastie.org/2102201

    Posted 12 years ago on Tuesday June 21, 2011 | Permalink
  5. Sophie
    Member

    Greatly appreciated. I'll let you know how I go!

    Posted 12 years ago on Tuesday June 21, 2011 | Permalink
  6. Sophie
    Member

    I've put the code in and tested the form but it doesn't seem to be working, unless I've missed something?

    http://dgv2.docksidegroup.com.au/buy-a-gift-voucher/

    Posted 12 years ago on Tuesday June 21, 2011 | Permalink
  7. Where did you implement the code? Did you place it in your themes functions.php file?

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  8. Also make sure you are in fact running the latest version of Gravity Forms which is v1.5.2.8. It is currently available via automatic update.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  9. Sophie
    Member

    The code went in to the functions.php file which I edited via ftp and the latest version of Gravity Forms was also uploaded via ftp.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  10. I'm not sure what to say other than to make sure you made the appropriate changes to the code. There are 2 places you need to set the form id for the form you want this custom code to apply to.

    Make sure you changed the form id in both the gform_pre_render filter and the gform_product_info filter, it's in 2 places.

    I just tested the code that we provided to you on my test site and it works fine. So there isn't a problem with the code itself.

    Posted 12 years ago on Wednesday June 22, 2011 | Permalink
  11. Sophie
    Member

    I went into the functions.php file and adjusted the settings 'gform_pre_render_57' to 'gform_pre_render_5' (because the id of the form is 5) and then the same to 'gform_product_info_57' to gform_product_info_5

    That was a little confusing, but now it is working. Thanks for the help.

    Posted 12 years ago on Thursday June 23, 2011 | Permalink
  12. Good to hear Sophie! Glad you got it worked out.

    Posted 12 years ago on Thursday June 23, 2011 | Permalink

This topic has been resolved and has been closed to new replies.