Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
How to Delete the credit card detail after processing order from the database
 
JoeVlcek
Jr. Member
 
Total Posts:  23
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.

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

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

 
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.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sdaugherty
Jr. Member
 
Total Posts:  18
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: 62)
 
Magento Community Magento Community
Magento Community
Magento Community
 
ppyne
Jr. Member
 
Total Posts:  2
Joined:  2013-02-08
 
sdaugherty - 07 September 2012 04: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:  4
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:  18
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
 
adamw1987
Jr. Member
 
Total Posts:  5
Joined:  2013-02-18
 

Hi any one still read this topic?

I get an error when i run this script?

[Wed Aug 14 03:42:32 2013] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception ‘Mage_Core_Model_Store_Exception’ in /var/www/magento/app/code/core/Mage/Core/Model/App.php:1357\nStack trace:\n#0 /var/www/magento/app/code/core/Mage/Core/Model/App.php(842): Mage_Core_Model_App->throwStoreException()\n#1 /var/www/magento/app/code/core/Mage/Core/Model/App.php(491): Mage_Core_Model_App->getStore()\n#2 /var/www/magento/app/code/core/Mage/Core/Model/App.php(274): Mage_Core_Model_App->_initCurrentStore(’default’, ‘store’)\n#3 /var/www/magento/app/Mage.php(615): Mage_Core_Model_App->init(’default’, ‘store’, Array)\n#4 /var/www/magento/ccp.php(6): Mage::app(’default’, ‘store’)\n#5 {main}\n thrown in /var/www/magento/app/code/core/Mage/Core/Model/App.php on line 1357

Any help would be appreciated

Thank You
Adam

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

Hello Adam,

Looks like Magento is throwing an exception when trying to initialize your store. Can I ask, what version are you using so I can look at the source for that version and see why the exception is getting thrown?

The line with the problem is as follows:

$app Mage::app('default''store');

Also,

If you could log into the admin panel and navigate to:

System > Manage Stores

Under the Store View Name column, click on the record for your store to load up a new page with more information.

On this page, what is the value in the Code field? Whatever it is, you should change MY php code above to reflect the value in that field. So....

$app Mage::app('_YOUR_STORE_CODE_''store');

Let me know your findings!

Thanks,
Seth

 
Magento Community Magento Community
Magento Community
Magento Community
 
adamw1987
Jr. Member
 
Total Posts:  5
Joined:  2013-02-18
 

Hi Seth

yes the store code fixed it ,seems running mulit stores needed a store code, im running 1.7.0.2

Thank You for your help

-Adam

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

Nice! Not a problem! Have a good day!

Seth

 
Magento Community Magento Community
Magento Community
Magento Community
 
overnightgrafix
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-12-13
 

CREDIT CARD DELETER

available for download

http://overnightgrafix.com/rancho-cucamonga-s-web-design-company-websites-quick-and-affordable/magento-extensions/credit-card-deleter-extension-for-magento-delete-the-credit-card-detail-after-processing-order-from-the-database.html

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