Naresh
Naresh

Reputation: 721

Get Transaction ID in Success Page

I've got this problem that I can't solve. Partly because I can't explain it with the right terms. I'm new to this so sorry for this clumsy question.

Below you can see an overview of my goal.

I'm using Magento CE1.8.1.0

I want to get Transaction ID in Success Page.

i tried in the following way but its not displaying.

$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
echo $order->getPayment()->getLastTransId();

So how can i get Transaction ID ?

Any thing wrong i did here ?

Any Ideas ?

Upvotes: 0

Views: 511

Answers (1)

Amit Bera
Amit Bera

Reputation: 7611

$OrderID=Mage::getSingleton('checkout/session')->getLastOrderId();
$transaction = Mage::getModel('sales/order_payment_transaction')->getCollection()
    ->addAttributeToFilter('order_id', array('eq' => $OrderID))
    ->addAttributeToFilter('txn_type', array('eq' => 'capture'))->getFirstItem();

$transaction object gives you truncation id

Upvotes: 1

Related Questions