I need to generate credit card surrogates (tokens) that are format preserving.

Posted by jammer59 on Stack Overflow See other posts from Stack Overflow or by jammer59
Published on 2010-03-22T16:29:28Z Indexed on 2010/03/22 16:31 UTC
Read the original article Hit count: 269

Filed under:

For an eCommerce application I need to take a credit card and use the real card for passing through to a payment gateway but I need to store, and return to the transaction initiator, a surrogate that is format preserving. Specifically, this means:

1) The number of digits in the surrogate is the same as the real card number (PAN). 2) The issuer type part of the card -- the initial 1,2 or 4 digits remains the same in the surrogate as in the original PAN. 3) The final 4 digits of the surrogate remain the same (for customer service purposes.) 4) The surrogate passes the Luhn mod10 check for a syntactially valid credit card.

I can readily handle requirements 1-3 but #4 has me completely stumped! The final implementation will be either t-sql or c#.

Any ideas?

© Stack Overflow or respective owner

Related posts about credit-card