1

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.

0

1 Answer 1

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:
                    $this->_registerPaymentCapture(true);
                    break;

                // the holded payment was denied on paypal side
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_DENIED:
                    $this->_registerPaymentDenial();
                    break;

                // customer attempted to pay via bank account, but failed
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_FAILED:
                    // cancel order
                    $this->_registerPaymentFailure();
                    break;

                // payment was obtained, but money were not captured yet
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_PENDING:
                    $this->_registerPaymentPending();
                    break;

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_PROCESSED:
                    $this->_registerMasspaymentsSuccess();
                    break;

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED:// break is intentionally omitted
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_UNREVERSED:
                    $this->_registerPaymentReversal();
                    break;

                case Mage_Paypal_Model_Info::PAYMENTSTATUS_REFUNDED:
                    $this->_registerPaymentRefund();
                    break;

                // authorization expire/void
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_EXPIRED: // break is intentionally omitted
                case Mage_Paypal_Model_Info::PAYMENTSTATUS_VOIDED:
                    $this->_registerPaymentVoid();
                    break;

                default:
                    throw new Exception("Cannot handle payment status '{$paymentStatus}'.");
            }
        } catch (Mage_Core_Exception $e) {
            $comment = $this->_createIpnComment(Mage::helper('paypal')->__('Note: %s', $e->getMessage()), true);
            $comment->save();
            throw $e;
        }
    }
1
  • I already did it more than enough time Commented 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.