4

We used the 'Saved CC' payment method in our Magento 1.9.1.0 store and now we would like to delete the credit card numbers for security reasons.

What is the easiest procedure to delete all credit card numbers?



UPDATE ON SEPTEMBER 21st, 2018:

I just tried to do that. I go to phpMyAdmin in the cPanel. There are 2 databases:

  1. mySITE_mySITE

  2. information schema

I highlight either, click on SQL, and enter the following lines (one at a time):

UPDATE sales_flat_order_payment SET cc_number_enc=NULL;
UPDATE sales_flat_order_payment SET cc_type=NULL;
UPDATE sales_flat_order_payment SET cc_last4=NULL;
UPDATE sales_flat_order_payment SET cc_owner=NULL;
UPDATE sales_flat_order_payment SET cc_exp_month=NULL;
UPDATE sales_flat_order_payment SET cc_exp_year=NULL;


UPDATE sales_flat_quote_payment SET cc_number_enc=NULL;
UPDATE sales_flat_quote_payment SET cc_type=NULL;
UPDATE sales_flat_quote_payment SET cc_last4=NULL;
UPDATE sales_flat_quote_payment SET cc_owner=NULL;
UPDATE sales_flat_quote_payment SET cc_exp_month=NULL;
UPDATE sales_flat_quote_payment SET cc_exp_year=NULL;

But then it gives me the following Errors:

Error
SQL query:
UPDATE sales_flat_order_payment SET cc_number_enc=NULL
MySQL said:  
#1146 - Table 'mySITE_mySITER.sales_flat_order_payment' doesn't exist



Error
SQL query:
UPDATE sales_flat_order_payment SET cc_number_enc=NULL
MySQL said:  
#1109 - Unknown table 'sales_flat_order_payment' in information_schema


What am I doing wrong?


Another UPDATE on September 21st:

it turns out that all that I needed to do was to add mg_ in front of the code like this:

UPDATE mg_sales_flat_order_payment SET cc_number_enc=NULL;
UPDATE mg_sales_flat_order_payment SET cc_type=NULL;
UPDATE mg_sales_flat_order_payment SET cc_last4=NULL;
UPDATE mg_sales_flat_order_payment SET cc_owner=NULL;
UPDATE mg_sales_flat_order_payment SET cc_exp_month=NULL;
UPDATE mg_sales_flat_order_payment SET cc_exp_year=NULL;


UPDATE mg_sales_flat_quote_payment SET cc_number_enc=NULL;
UPDATE mg_sales_flat_quote_payment SET cc_type=NULL;
UPDATE mg_sales_flat_quote_payment SET cc_last4=NULL;
UPDATE mg_sales_flat_quote_payment SET cc_owner=NULL;
UPDATE mg_sales_flat_quote_payment SET cc_exp_month=NULL;
UPDATE mg_sales_flat_quote_payment SET cc_exp_year=NULL;

And now it works!

5

The encrypted credit card numbers are stored in the cc_number_enc column of the sales_flat_order_payment table. With this SQL query you can delete them all:

UPDATE sales_flat_order_payment SET cc_number_enc=NULL;

To delete all credit card data, do the same with the other columns that start with cc_:

  • cc_type
  • cc_number_enc
  • cc_last4
  • cc_owner
  • cc_exp_month
  • cc_exp_year
  • I tried to do this but I think I must be doing it wrong because I get Error messages and I don't think it actually executes. Would you please look at my update above in the original post? – Allysin Sep 21 '18 at 10:11
  • I added mg_ and it works now. Thanks! :o) – Allysin Sep 21 '18 at 10:45
1

You will also need to use the same command on sales_flat_quote_payment as credit card numbers are stored in this table as well.

  • I tried to do this but I think I must be doing it wrong because I get Error messages and I don't think it actually executes. Would you please look at my update above in the original post? – Allysin Sep 21 '18 at 10:11
  • I added mg_ in front of the code and it works now. Thanks! :o) – Allysin Sep 21 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.