Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Credit card detail in Magento

Tags:

php

magento

How can I get the credit card detail in Magento from OnepageController.php? I have retrieved all the other information like billing information, shipping information and user details. I am using the following to get the card detail but it returns blank:

$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$order  = Mage::getModel('sales/order')->load($lastOrderId);
$card_exp_month     = $order->getCcExpMonth($lastOrderId);///(Nahi AAya)
$card_exp_year      = $order->getCcExpYear($lastOrderId);///(Nahi AAya)

When I print $card_exp_month and $card_exp_year, both are blank. Is there another way by which I can determine the credit card detail? I'm looking for CC number, expiry year and expiry month.

like image 257
mjdevloper Avatar asked Jan 03 '11 09:01

mjdevloper


People also ask

Does Magento store credit card numbers?

Does Magento save credit card numbers in the database when the Authorize.net payment method used? No, that information is sent via a token to Authorize.net and confirmed or denied.

Does Magento 2 have a saved credit card payment method?

The Magento 2 credit card payment module lets customers save their credit card details. They have to enter their credit card number and the expiry date one time.

What is payment gateway in Magento?

The Magento payment provider gateway is a mechanism that allows you to integrate your stores with payment service providers. As a result, you can create and handle transactions based on order details.


1 Answers

Instead of $order->getCcExpMonth($lastOrderId) try $order->getPayment()->getCcExpMonth($lastOrderId).

Use print_r($order->getPayment()->debug()) to see what other values are available, or view the sales_flat_order_payment table to see some more examples.

like image 141
clockworkgeek Avatar answered Sep 20 '22 18:09

clockworkgeek