Magento 1.9 – Payment Status Shows Due After Successful Transaction

magento-1.9payment-gateway

I have integrated & configured PayU in my website. When I buy a product the transaction is successful and the payment is taking place. But the order details in the admin panel shows payment as due. Could anyone help me to sort it out??

Best Answer

Praseetha.According to magento order payment done mean order invoice is created. So,on Magento payu extesion return success action ,you need to create Invoice of order that order,thus order payment status change to paid

$order=Mage::getModel('sales/order')->load($orderID);
if($order->canInvoice() and $order->getIncrementId())
{
$items = array();
foreach ($order->getAllItems() as $item) {
    $items[$item->getId()] = $item->getQtyOrdered();
    }

                $invoiceId=Mage::getModel('sales/order_invoice_api')->create($order->getIncrementId(),$items,null,false,true);
Mage::getModel('sales/order_invoice_api')->capture($invoiceId);

Details:How create invoice Programmatically