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.
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)
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’:
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:
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.
Support forum for Event Espresso 3 and Event Espresso 4.