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.

Configuration options

When creating an algorithm using the Payment Card framework, configure the following options.

Option Description
Minimum Masked Positions The minimum number of digits that must be replaced during masking. 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].
Preserve Starting Digits Number of leading digits that remain unchanged during masking. 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].

Example

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.

Create an algorithm using this framework

To create an algorithm using this framework, follow the steps in Create an algorithm and select Payment Card during the Configuration step.

Last updated
Oct 8, 2026