Posted: September 7, 2023 at 9:09 am
Hi all, I need to create a function that does the following, could I get some guidance on what hook I need and the quickest way to grab the info please? This needs to fire when a payment has been made (and stripe has confirmed the payment has been received). Then I need to be able to: For this specific type/category of event we are limiting it to one per order, so there would only ever be 1 delegate against the event. Thank youuuuu! Zoe |
|
September 11, 2023 at 12:59 pm Hi Zoe, A good hook to use would probably be:
which gives you access to:
you can check the status of the payment using Then to do the following:
you can get the list of registrations from the transaction object:
then get the events from the registrations:
Hope that helps! |
|
Thanks Brent this is really helpful! Where can I get a list of payment codes for EEM_Payment? We’ll be using stripe so I’ll just be looking for whatever confirms stripe successfully took payment. Cheers 🙂 Zoe |
|
As soon as you open up EEM_Payment.model.php you’ll see the payment statuses available, like THIS.
You don’t actually need the Stripe specific payment status as the EE_Payment object will have been updated at that point, you’d be looking to confirm the transaction status is complete and if checking individual EE_Payment objects you ca use something like:
Also, depending on the specifics of what this is for you could also just hook into when a registration is Approved, within EE_Registration.class.php there is a set_status() method, that is used to set the registration status which happens automatically when a payment is made in full (although also can happen at other times). So this action:
Fires when a registration status is set to Approved, $this, will be an EE_Registration object. $old_STS_ID is what thee status was before this recent update, $new_STS_ID is what its just been set to (In this case it will be Approved) and $context gives you more details on what is updating the status. It really depends on the specifics of what you are using these for, Brents hook also works fine so this is just another option. |
|
You must be logged in to reply to this support post. Sign In or Register for an Account