Support

Home Forums Event Espresso Premium Getting payment and transaction objects from hook after payment is applied Reply To: Getting payment and transaction objects from hook after payment is applied

Reply To: Getting payment and transaction objects from hook after payment is applied

Author Replies
deon@dieselbrook.co.za # Posted on May 3, 2018 at 2:32 am

Ah okay, you learn something new every day, thanks 🙂

I’ve now inspected the $payment and $transaction objects that is passed to the hook (AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful), and I can see all the data that I need there. But it is protected, So I’ve tried using get_first_event public method located in the EE_Payment class in order to get the data:


if ($payment instanceof EE_Payment)
{
$event = $payment->get_first_event();
$event_id = $event->ID();
wp_mail('john-henry@dieselbrook.co.za', 'Event Id', $event_id );
}
else
{
return;
}

But this still isn’t working, even though it is a public method.

The thing is I want this to happen every time there is a successful payment applied to the transaction, either VIA bank transfer (applied from the backend) or from a payment gateway. So I wouldn’t necessarily know the ID of the transaction.

Do NOT follow this link or you will be banned from the site!