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
Tony # Posted on May 3, 2018 at 3:27 am

I saw in your code that you called the transaction via its ID in line 6.

I’m pulling a Transaction by ID so that I have a Transaction in the console, I’m replicating the object you have available on that hook, this was my previous reply:

I’m using your code in WP console and replicating it by pulling in an EE Transaction, then pulling a payment from that transaction so I have the same objects you should have

You don’t need to know the ID, you already have the transaction object passed to the hook.

I am currently using a payment gateway, not from the admin itself (but the hook still gets called, as tested from my previous code).

Which payment gateway?

Add the write_log function I gave you above to either, enable WP_Debug using the snippet I gave you and then add:

write_log($payment); (just above your EE_Payment conditional)

write_log($event); (just after you’ve create $event)

write_log($event_id); (just after you’ve created $event_id)

before the email is sent, retest and check the debug.log file to see if you have the objects written to the log.

There are too many unknowns in your code right now, you don’t know if if ($payment instanceof EE_Payment) is failing, if the wp_mail() call is failing or even if if ($payment instanceof EE_Payment) is passing and then there’s a fatal after that.

In short, break down your code and check each variable as you run through to find what is actually being run and what they contain before you use them, right now you don’t know if the email is sent or not and just that it doesn’t work, you need to narrow that down to the specific area that fails because the above is working for me.

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