I have an issue with Magento 1.9 and PayPal payment method. When a customer pays with PayPal and there is a payment review the order in such cases order status would be set to "Payment Review" that is correct.

However, the problem is, in instances where the payment actually fails (i.e., insufficient funds in customer account), Magento updates order status to "Processing" & customers ends up getting free goods.

What I need to do is, when such "Failed" IPN invoked I need to set "Closed" status to that particular order. I spent more that 4 hours to find the solution but didn't found any proper solution.

If someone have any fixes for this please share with me. enter image description here PayPal IPN response variables:

    [payer_email] => [email protected]
    [payer_id] => xxxxxxxxxxxx
    [payer_status] => unverified
    [payment_date] => 14:33:46 Jun 08, 2015 PDT
    [payment_gross] => 43.24
    [payment_status] => Failed
    [payment_type] => echeck
    [protection_eligibility] => Ineligible

Any help would be highly appreciated.


1 Answer 1


If you are using Paypal IPN check the following code

class : Mage_Paypal_Model_Ipn

     * Process regular IPN notifications
    protected function _registerTransaction()
        try {
            // Handle payment_status
            $paymentStatus = $this->_filterPaymentStatus($this->_request['payment_status']);
            switch ($paymentStatus) {
                // paid
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_COMPLETED:

                // the holded payment was denied on paypal side
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED:

                // customer attempted to pay via bank account, but failed
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED:
                    // cancel order

                // payment was obtained, but money were not captured yet
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING:

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED:

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED:// break is intentionally omitted
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED:

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED:

                // authorization expire/void
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED: // break is intentionally omitted
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED:

                    throw new Exception("Cannot handle payment status '{$paymentStatus}'.");
        } catch (Mage_Core_Exception $e) {
            $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true);
            throw $e;
  • I already did it more than enough time Mar 23, 2016 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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