2

If a customer pays via PayPal and his account is not covered, the order in Magento is in the state "payment_review". You can then:

  1. Accept the payment manually.
  2. Deny the payment.
  3. Get a payment update.

As shown in this screenshot:

accept payment, deny payment, get payment update

What clients mostly do is to get the payment update every once in a while. If the account is covered again, the client will get an information that the payment was successful and that the order can now be processed. The issue is that clients often forget that, so that these orders do not get updated/processed. And after 30 days, the payment is automatically cancelled by PayPal.

Is there any available solution, which gets these payment updates automatically? It should be fairly simple to implement with a nightly cronjob, which gets a payment update for all orders in the payment_review state, but I first wanted to check if there is any standard solution to this issue?

1 Answer 1

1
  1. Write an extension skeleton.
  2. Add the following to your config.xml under the config node:

    <crontab>
        <jobs>
            <shop_updatepaypalpayment>
                <schedule>
                    <cron_expr>42 3 * * *</cron_expr>
                </schedule>
                <run>
                    <model>shop_updatepaypalpayment/cron::cronUpdatePaypalPayment</model>
                </run>
            </shop_updatepaypalpayment>
        </jobs>
    </crontab>
    
  3. Implement the cron method:

    public function cronUpdatePaypalPayment()
    {
        /** @var Mage_Sales_Model_Resource_Order_Collection $orderCollection */
        $orderCollection = Mage::getModel('sales/order')->getCollection()
            ->addFieldToFilter('state', Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW);
    
        foreach ($orderCollection as $order) {
            if ($order->canFetchPaymentReviewUpdate()) {
                $order->getPayment()->registerPaymentReviewAction(
                    Mage_Sales_Model_Order_Payment::REVIEW_ACTION_UPDATE, true
                );
                $order->save();
            }
        }
    }
    

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.