Support

Home Forums Event Espresso Premium Event info in Custom Offsite Gateway post data

Event info in Custom Offsite Gateway post data

Posted: February 20, 2016 at 7:19 pm


fjorgeDigital

February 20, 2016 at 7:19 pm

Is there a way to pass event info into the $payment->set_redirect_args of a custom offsite gateway? I need to pass the event name and the event category slug and/or event meta.


Lorenzo Orlando Caum

  • Support Staff

February 21, 2016 at 5:58 pm

Hi,

What payment gateway are you working on?

Mijireh which is part of Event Espresso 4 has a filter that can be used to include the event name.

Here is the link to that line of code:

https://github.com/eventespresso/event-espresso-core/blob/4.8.33.p/caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php#L46

Here is an example of how that code can be used to pass the event name:

https://eventespresso.com/topic/add-event-title-to-mijireh-slurped-page/#post-190812


Lorenzo


fjorgeDigital

February 21, 2016 at 7:41 pm

Creating a gateway for Firstech. I’d like to get access to the event ID because I need to change the API key based on the type of event (category or some event meta)


Tony

  • Support Staff

February 22, 2016 at 1:49 am

Hi there,

Because set_redirect_args() is passed the EE_Payment object you can use that to pull in EE_Event object, which gives you access to the ID. Within the code Lorenzo posted you can see how Mijireh does this by first grabbing the transaction from the payment:

$transaction = $payment->transaction();

From there it uses the $transaction to pull the ‘Primary registrant’:

$primary_registrant = $transaction->primary_registration();

From the primary registrant object you grab the EE_Event object:

$event = $primary_registrant->event()

Then finally from EE_Event object you can return the event ID

$EVT_ID = $event->ID();

You can then do whatever you wish to do with the ID.

As this is custom coding we can’t provide support for this however we can help point you in the right direction, I would recommend taking a look at some of the posts here:

http://developer.eventespresso.com/?s=query+model&submit=Search

More specifically, this post:

http://developer.eventespresso.com/docs/using-ee4-model-objects/

Which explains a little more how to use the EE model objects to pull in the info you want.


fjorgeDigital

February 24, 2016 at 8:33 am

Thanks for your responses. I was able to get what I needed using the info you provided.


Tony

  • Support Staff

February 24, 2016 at 8:42 am

You’re most welcome.

Which payment provider as you using?

Would you be interested in sharing the project?

The support post ‘Event info in Custom Offsite Gateway post data’ 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