Support

Home Forums Event Espresso Premium Different payment gateways for different events

Different payment gateways for different events

Posted: September 30, 2013 at 7:13 am


jcooper

September 30, 2013 at 7:13 am

Hi,

We have two different Worldpay accounts which are used for different event locations.

Is there a way of setting this up with event espresso.

-Alex


Josh

  • Support Staff

September 30, 2013 at 10:01 am

Hi Alex,

There’s a way to make this happen with the PayPal and Stripe gateways along with the Meta key box.

Basically how this works with the PayPal and Stripe gateways is you enter an alternate payment ID in the event’s Event Meta box.

You can modify the WorldPay gateway to do use the same feature. If you look in /gateways/worldpay/worldpay_vars.php you’ll find the line where the WorldPay ID pulls in the WorldPay Installation ID setting (to set the instID field) on line 21:

$myworldpay->addField('instId', $worldpay_settings['worldpay_id']);

Just before line 21 you can add this check:

//Check for an alternate WorldPay account
if (isset($event_meta['worldpay_id']) && !empty($event_meta['worldpay_id']) && filter_var($event_meta['worldpay_id'], FILTER_VALIDATE_EMAIL) != FALSE) {
	//Alternate WorldPay ID - using the worldpay_id meta key field.
	$my_worldpay_id = $event_meta['worldpay_id'];
} else {
	$my_worldpay_id = empty($worldpay_settings['worldpay_id']) ? '' : $worldpay_settings['worldpay_id'];
}

then change the instID field to use your new variable:

$myworldpay->addField('instId', $my_worldpay_id);

What will happen is the default payment account will be used for events where no worldpay_id key is entered. The events that have a valid Worldpay Installation ID entered as the value for the worldpay_id key will use the alternate account.

Hope that helps!

The support post ‘Different payment gateways for different events’ 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