I'm using a number of hooks to set a credit card surcharge to an event registration. I have it mostly working, however there are some cosmetic issues remaining.

Using hook_civicrm_preProcess, I have been able to set the line item surcharge, which on viewing the registration confirmation page is showing correctly.

Below the line item cost is an Event Total row. This is the problem I'm having - the Event Total is not reflecting the change to the line item cost.

I have tried amending the $form->_totalAmount value in hook_civicrm_buildForm but this doesn't reflect the change either. Either I'm trying to set the wrong value or the confirmation page has already been built before hook_civicrm_buildForm has been called.

Any advice would be most welcome!

  • Did you had a look at the possible hooks at the CiviCRM Wiki? I have found this hook_civicrm_buildAmount. See wiki.civicrm.org/confluence/display/CRMDOC/… – Jaap Jansma - CiviCooP Sep 14 '15 at 7:29
  • If this is for use in the U.S., you should check with your attorney. Doing this in certain states may be illegal. Your bank/credit card processor may also have a problem with it. It usually a better idea to offer a cash discount. – DaveD - BackOffice Thinking Sep 14 '15 at 17:54
  • Not in the US, @DaveD. This one is on my client, they can deal with any legalities! – user496 Sep 14 '15 at 23:08
  • Thanks, @JaapJansma, I'll take a look and see if that helps! – user496 Sep 14 '15 at 23:09
  • Unfortunately I've not had any luck in using buildAmount because this is called before the user selects a payment method. The important bit is making the surcharge amend based on the payment method. – user496 Oct 6 '15 at 5:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy