Magento – How to get credit card number and cvv code in redirect payment method

checkoutcreditmemoonepage-checkoutpayment-gateway

Basically i have this lines:

<?php

// Retrieve order
    $session = Mage::getSingleton('checkout/session');
    $orderIncrementId = $session->getLastRealOrderId();
    $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
    $billingaddress = $order->getBillingAddress();
    $shippingaddress = $order->getShippingAddress();
    $currencyDesc = Mage::app()->getStore()->getCurrentCurrencyCode();
    $totals = number_format($order->getGrandTotal(), 2, '.', ''); 
    $address = $billingaddress->getStreet();
    $address1 = $shippingaddress->getStreet();
    $payment = $_order->getPayment();

if($payment->getCcExpMonth() < 10){
    $expMonth = '0'.$payment->getCcExpMonth();
}
else{
    $expMonth = $payment->getCcExpMonth();
}

echo $expMonth;

echo substr($payment->getCcExpYear(),-2);

echo $payment->getCcNumber(); //lose

echo $payment->getCcCid(); //lose

?>
<form name="mygatewayform" method="post" action="https://banwire.com/qa/api/1/payment/direct">
<input type="hidden" name="CARD_OWN" value="<?php echo $payment->getCcOwner(); ?>">
    <button type="submit">Pagar Ahora</button>
</form>
<script type="text/javascript">
//document.mygatewayform.submit();
</script>

after the process in the checkout this redirect to /mygateway/rediret.phtml and this file, redirecto to gateway banwire, but
i need find the credit card number and cvv code just for send this form to banwire gateway, is there any way to do???

Best Answer

It is not quite clear what your payment method is doing.

Usually when you are redirecting to the payment gateway's payment page the purpose is that your site never sees the customer's credit card on purpose, ie the credit card number and CCV are only entered on banwire.com

If you are indeed using an onsite payment method (based on Magento's credit card implementation) you would not need to use the redirect form as you would submit directly to the payment gateway during the checkout process.

Related Topic