Try the Demo

Magento Forum

   
Page 2 of 2
How to Delete the credit card detail after processing order from the database
 
JoeVlcek
Jr. Member
 
Total Posts:  18
Joined:  2012-03-11
 

Why would you want to collect that data in the first place? A third party processor should always be used. Let them collect the data and process. They can scrub better than anyone and it is so much safer.

You pay an extra 1-2% for this, but conversions will probably increase by this much because buyers see that you are not collecting the data, a secure, trusted third party is doing it. There are some big name processors out there who are well trusted by consumers.

 Signature 

We Increased Revenue by 300%! See the Case Study Here

Need Magento Hosting? Check out our friends, Mage Mojo

 
Magento Community Magento Community
Magento Community
Magento Community
 
xantek
Jr. Member
 
Total Posts:  16
Joined:  2011-01-21
United States
 

I agree with the “should” but despite strongly explaining the issues it was ultimately a client demand.

 Signature 

Cheers,
Ian Carlson
Xantek Inc.

 
Magento Community Magento Community
Magento Community
Magento Community
 
akash986
Jr. Member
 
Total Posts:  5
Joined:  2012-08-08
 

Since it\’s not the best exercise to shop bank cards figures on the hosting server for guide transaction handling, there should be a way do remove the CC details after handling the guide transaction.

My recommendation is to make it so that when you go to a awaiting purchase that has a guide transaction, once they have prepared the transaction personally and then simply select \’Mark as Paid\’ a pop up box says \’Are you sure you want to indicate as compensated, this will remove the bank cards information from the database\’, and then if they click on yes it erases the complete bank cards variety out of the data source instantly. That way there isn\’t an limitless amount of old bank cards figures in the data source.

 Signature 

Buy a business

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdaugherty
Jr. Member
 
Total Posts:  16
Joined:  2009-03-13
Ohio
 

Just had to deal with this as well. I wrote a module that purges credit card info when an order’s state changes to COMPLETE or CANCELED. Also wrote a one-time script to be run to purge all credit card data on complete/canceled orders in the system prior to installing the module. Below is the script I wrote if anyone runs into this problem.

Running instructions:
1.) Create a file named ccpurge.php (or whatever you want it to be called) inside your magento installation directory
2.) Place this code inside the php file
3.) Run php file on the server from your browser

Note: Depending on the amount of orders in your system, you may need to increase the php memory limit and execution time

Let me know if anyone has any questions.

<?php
// Load up the Magento environment
include('includes/config.php');
require_once(
'app/Mage.php');
umask(0);
$app Mage::app('default''store');
$storeId $app->getStore()->getId();

// Load Orders
$orders Mage::getModel('sales/order')
                ->
getCollection()
                ->
addFieldToFilter('state', array('in' => array('complete''canceled')))
                ->
addFieldToFilter('store_id'$storeId)
                ->
load();

foreach(
$orders as $order)
{
    
// Get the payment information for this order
    
$payment $order->getPayment();

    
// Only purge Credit Card (Saved) orders.
    
if ($payment->getMethodInstance()->getCode() == 'ccsave')
    
{
        $payment
->setCcOwner('n/a');
        
$payment->setCcNumberEnc($payment->encrypt('xxxx-'.$payment->getCcLast4()));
        
$payment->setCcExpMonth('00');
        
$payment->setCcExpYear('0000');
        
$payment->save();
    
}
}

?>

File Attachments
ccpurge.php  (File Size: 1KB - Downloads: 36)
 
Magento Community Magento Community
Magento Community
Magento Community
 
ppyne
Jr. Member
 
Total Posts:  2
Joined:  2013-02-08
 
sdaugherty - 07 September 2012 05:50 PM

Just had to deal with this as well. I wrote a module that purges credit card info when an order’s state changes to COMPLETE or CANCELED. Also wrote a one-time script to be run to purge all credit card data on complete/canceled orders in the system prior to installing the module. Below is the script I wrote if anyone runs into this problem.

Running instructions:
1.) Create a file named ccpurge.php (or whatever you want it to be called) inside your magento installation directory
2.) Place this code inside the php file
3.) Run php file on the server from your browser

Note: Depending on the amount of orders in your system, you may need to increase the php memory limit and execution time

Let me know if anyone has any questions.

<?php
// Load up the Magento environment
include('includes/config.php');
require_once(
'app/Mage.php');
umask(0);
$app Mage::app('default''store');
$storeId $app->getStore()->getId();

// Load Orders
$orders Mage::getModel('sales/order')
                ->
getCollection()
                ->
addFieldToFilter('state', array('in' => array('complete''canceled')))
                ->
addFieldToFilter('store_id'$storeId)
                ->
load();

foreach(
$orders as $order)
{
    
// Get the payment information for this order
    
$payment $order->getPayment();

    
// Only purge Credit Card (Saved) orders.
    
if ($payment->getMethodInstance()->getCode() == 'ccsave')
    
{
        $payment
->setCcOwner('n/a');
        
$payment->setCcNumberEnc($payment->encrypt('xxxx-'.$payment->getCcLast4()));
        
$payment->setCcExpMonth('00');
        
$payment->setCcExpYear('0000');
        
$payment->save();
    
}
}

?>

This works flawlessly. Thanks so much! Running 1.7.0.2

 
Magento Community Magento Community
Magento Community
Magento Community
 
romanza
Jr. Member
 
Total Posts:  3
Joined:  2012-01-04
 

I’m new to this so please forgive me for being naive but how do you “Run php file on the server from your browser”?

I’ve created the php file so I’m good there.

Thanks in advance!

John

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdaugherty
Jr. Member
 
Total Posts:  16
Joined:  2009-03-13
Ohio
 

John (romanza),

All that means is ‘Navigate to that file in your browser’ just as you would any other page on a website.

Example:

http://www.website.com/magento/ccpurge.php

That will run the script.

Let me know if that makes sense.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 2