Showing results for 
Search instead for 
Did you mean: 

Best practices: storing transaction info

Hi.  I'm curious how much information people generally store regarding credit card transactions.  For example, when I process a payment, I do the following:

- update the user's account balance record accordingly

- insert the individual transaction info in a 'transactions' table 


For the individual transaction record, I store

- user_id

- amount

- (authnet) transId

- timestamp


Is the transID alone enough? Or is it better to store the entire xml response? Or something in between?


(I've found several posts that touch on this subject but I haven't seen this exact question addressed.)


Depends on what you intend to do with the data. If transactions are basically fire and forget and everything is automatic, like with a store that's 100% online fulfillment, there may be no need to store any additional data locally. Personally, I deal more with sites that do like to look up customer data, or even dump out addresses to a file so they can batch mail or do order fulfillment or whatever, so in that case the customer's name, address, etc. should be stored locally.


The more interesting question is how to deal with something like DPM, where the form is on your site but submits directly to If the user doesn't fill out the form all the way, or submits but the transaction doesn't go through, how do you deal with it? I set up an AJAX call triggered by onchange() on certain fields on the form (name, address, phone, email) that passes just those pieces of data to a secondary page, which then updates the record BEFORE the user submits the form. This allows those people to be contacted for feedback, or mailed next time there's a special offer, or whatever, rather than just having them disappear forever because their order didn't go through.