1

I need to get order id after payment is successfully completed. Is there observer to do this?

1

You can use the sales_order_payment_pay event to get the order id after payment is completed successfully.

below code in etc/config.xml

<?xml version="1.0"?>
<config>
    <global>
        <events>
            <sales_order_payment_pay>
                <observers>
                    <Namespace_Module>
                        <type>singleton</type>
                        <class>Namespace_Module/Observer</class>
                        <method>getOrder</method>
                    </Namespace_Module>
                </observers>
            </sales_order_payment_pay>     
        </events>
     </global>
</config>

and Model/Observer.php

public function getOrder($observer) {
    $orderId = $observer->getPayment()->getOrder()->getId();
    $orderNumber = $observer->getPayment()->getOrder()->getIncrementId();
}

Just to clarify; The order ID is used internally in the database. The order number is what's displayed on screen and looks like #100000153

3

Yes there are few events related to payment.

I would suggest to use this one: sales_order_payment_pay.

Complete events

I believe you already know how to use observer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.