Home Forums Event Espresso Premium Customising Payment Gateway: hook for addField()

Customising Payment Gateway: hook for addField()

Posted: September 10, 2012 at 7:29 am

Viewing 2 reply threads


September 10, 2012 at 7:29 am

My client has some special demands: they want to bill customers with the additional fees for taking credit card payments (2.5%), and offer a part-payment option (take payment in two installments).

For the first task I can adjust the fee before submitting the payment gateway form with the action_hook_espresso_display_offsite_payment_gateway action which is great.

But for the part-payment option, I need to add some extra fields to the gateway submission (WorldPay). I can see in espresso_display_worldpay() exactly where to add these – $myworldpay->addField(), but AFAIK there’s no hook to manipulate the gateway instance before it gets printed with $myworldpay->submitButton().

Do I have to duplicate the whole worldpay_vars.php in the espresso/uploads folder and edit it? I wanted to avoid this to make my customisation less fragile – I’ve actually been hired to update the client’s site so they can update EE without it breaking each time.

Chris Reynolds

  • Support Staff

September 10, 2012 at 5:57 pm

uploading to the /wp-content/uploads/espresso folder won’t break Event Espresso on an update but if you’re changing core functionality then you’d need to make sure that any changes to the gateway files in core are copied over to your custom code. That said, no, Event Espresso doesn’t support partial payments at all. In 3.2 this may be possible because of how we’re changing the payment functionality — it’s one of the things we still have plans on adding to the WePay gateway that we were commissioned to build but the infrastructure isn’t there right now.


September 11, 2012 at 2:15 am

Thanks a lot Chris. Partial payments in WorldPay is simple to integrate AFAIK because you only need to pass some extra fields:

$myWorldpay->addField('futurePayType', "regular");
$myWorldpay->addField('noOfPayments', "1");          

So for this project my only requirement is an action hook in world_vars.php that allows the PaymentGateway instance to be modified, this is what I’m adding:

do_action('action_hook_espresso_payment_gateway_fields', $myworldpay);

I think with that I can do everything in hook functions, which means no need to copy the files into uploads/espresso. Thanks again for your help.

Viewing 2 reply threads

The support post ‘Customising Payment Gateway: hook for addField()’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso