This page uses Hazel Tags and tokens to confirm that a card is 13 to 16 digits long and composed of nothing but numerals. The page then goes on to scramble several digits of the card number.
For real-life use, you'd vary the encryption formula somewhat to make it unique to you (don't use a published encryption system!) and put it in your store_invoice.txt template. Obviously, you'd omit all documentation and clues to how to decrypt the number.
In this version, no attempt is made to prevent a "bad" number from being processed. You could easily throw a Hazel-True tag around the processing code to block bad numbers from being run. However, this code is intended to go on the store invoice template, and it is assumed that the credit card number has already been tested by Hazel before getting to this point, so there's likely no need to test the number in real life. Here's we're just demonstrating ways to test and process the card numbers.
Enter a test credit card number here:
To derive the original credit card number, multiply the first two digits of the card number by the last two digits of the client number, and use the 4 right-hand digits of that number. Subtract that result from the scrambled card number. (If there are fewer than 4 digits, use the complete number.)
In an abundance of caution, the programming uses a 7-digit sub-string of the number for the subtraction operation to ensure all the digits that could possibly be affected are present. The programming then concatenates the first part of the card number -- in the present pass, %HZV_LEFTLENGTH digits -- to the unscrambled 7 right-hand digits.
Decryption result: