Tutorialsplane

Magento Get Payment Information


Magento Get Payment Information : You can use order model Mage::getModel(‘sales/order’) to fetch the payment information. Using this model you can get the details about the payment method which was used while creating the order. Here in this tutorial we are going to explain how you can get the payment detail using the sales order model.


Magento Get Payment Information

You can get the payment instance from the order object as below –

Magento Get Payment Information:

 $orderId = 111;
 $order = Mage::getModel('sales/order')->load($orderId);
$payment = $order->getPayment();

Which will give you the payment instance of the object.

More Details About Payment

Let us have more details about the payment.

Magento get credit card type : Payment

You can get the credit card type as below-

Magento get credit card type : Payment:

$orderId = 111;
$order = Mage::getModel('sales/order')->load($orderId);
$payment = $order->getPayment();
$creditCardType = $payment->getData('cc_type');

This will give you the credit card type used in order.

Magento get payment method code from Order

You can get the payment method code as below-

Magento get payment method code from Order

$orderId = 111;
$order = Mage::getModel('sales/order')->load($orderId);
$payment = $order->getPayment();
$paymentMethodCode = $payment->getMethodInstance()->getCode();

This will give you the payment method code used in order.

Magento get payment method Title from Order

You can get the payment method title as below-

Magento get payment method title from Order

$orderId = 111;
$order = Mage::getModel('sales/order')->load($orderId);
$payment = $order->getPayment();
$paymentMethodTitle = $payment->getMethodInstance()->getTitle();

This will give you the payment method title used in order.

Magento get credit card information

You can get credit card information as below-

Magento get credit card information

$orderId = 111;
$order = Mage::getModel('sales/order')->load($orderId);
$payment = $order->getPayment();
$payment->getMethodInstance()->getCardsStorage();
$payment->getMethodInstance()->getCardsStorage()->getCards();

This will give you the credit card information.