The Payment Card framework masks payment card numbers based on the starting digits to be preserved and the minimum number of positions to be masked. This framework is built on top of the Character Mapping Algorithm Framework with a character set of [0-9]. All characters outside of this character group remain unmasked. Masked values are calculated algorithmically using the algorithm's key, so rekeying the algorithm will cause different outputs to be generated for each input. The last digit may remain the same if the calculated check digit is equivalent to the last digit of the input. Any inputs with more than one digit will never mask to the original value.
Any inputs with a single digit will remain unmasked.
This framework preserves the validity of the payment card number using the Luhn check. All input values with valid Luhn checks will be masked to values with valid Luhn checks. All invalid values with invalid Luhn checks will be masked to values with invalid Luhn checks.
Creating a Payment Algorithm via UI¶
In the upper right-hand region of the Algorithm tab under Settings, click Add Algorithm.
Select Payment Card. The "Create Payment Card Algorithm" pane appears.
Enter an Algorithm Name.
This MUST be unique.
Enter a Description.
Set Minimum Masked Positions. This value is the minimum number of positions that must be replaced for masking to be considered successful. If fewer positions are masked, a non- conforming data handling error is triggered. Values for this field must be in the range [0-32].
Set Preserve Starting Digits. This value specifies how many maskable characters should be preserved from the beginning of the input. Only maskable characters are included in this count. Values for this field must be in the range [0-32].
When you are finished, click Save.
For information on creating Payment Card algorithms through the API, see API Calls for Creating Algorithms - Payment Card.
As an example, a Payment Card algorithm with a minMaskedPositions value of 6 and a preserve value of 6 may mask as follows:
- "5419033646326699" → "5419036803270758"
- "5419-0336-4632-6699" → "5419-0368-0327-0758"
- "5319abc0339def4632ghi6599!" → "5319abc0364def1507ghi4137!"
All inputs with the same sequence of digits masked with the same algorithm configuration will result in the same output values.