Credit card processing

Nelson Zink zink at newmex.com
Wed Dec 1 14:45:01 EST 2004


To all,

For what it's worth here is an algorithm to identify 'good' credit card
numbers:

 ---- Determine the number of digits
    if the number of chars of temp =16 or the number of chars of temp=13
then
 ------Verification Algorithm
    if the number of chars of temp=16 then
      repeat with zz=1 to 8
        put 2*(char ((2*zz)-1) of temp) into CC
        if CC>=10 then put (cc mod 10)+1 into char ((2*zz)-1) of temp
        else put CC into char ((2*zz)-1) of temp
      end repeat
    end if
    
    if the number of chars of temp=13 then
      repeat with zz=1 to 6
        put 2*(char (2*zz) of temp) into CC
        if CC>=10 then put (cc mod 10)+1 into char (2*zz) of temp
        else put CC into char (2*zz) of temp
      end repeat
    end if
    
------ Sum all digits
    put empty into TT
    repeat with zz=1 to the number of chars of temp
      add char zz of temp to TT
    end repeat
     if TT mod 10 is not 0 then put "Number in error, re-enter Credit Card
number."

    else put "Re-enter Credit Card number-- incorrect number of digits."

end if
 

Nelson



More information about the use-livecode mailing list