Get customer object on an event

I’m trying to createan observer on the following event.:

However according to magento doc

I don’t have so much parameters avalaible on this event..

Do you have any idea how I could retrieve the customer object (i would need info such as customer id and customer email)?

Thanks for your feedback and anyway I wish you a nice day,


2 thoughts on “Get customer object on an event”

  1. This event does expose the payment object, so you should be able to chain off of that to get the object you want:

    public function yourObserverFunction($event) {
        $payment = $event['payment'];
        $customer = $payment->getOrder()->getCustomer();
        // ... do something useful

    Generally objects in Magento can be chained like this, and now your code doesn’t rely on the event being triggered from a customer session (which is not a good assumption anyway).

    Hope that helps!


  2. Every event exposes different objects inside of the $observer object that is passed around. In Magento you can often get a lot of stuff by referring to any number of objects that are in the request or session. In this case there is a customer/session object (Mage_Customer_Model_Session) which has the customer attached.


Leave a Reply

Your email address will not be published. Required fields are marked *