Magnetic stripe tracks
D1 builds magnetic stripe Track 1, Track 2, and Track 3 during physical card personalization. You can also override any track by sending a full track value.
How D1 selects track values
If you provide
trackData.track1,trackData.track2, ortrackData.track3, D1 uses that value as-is.If you omit a track, D1 computes it from your D1 API inputs and your D1 configuration.
Inputs used for personalization
Required D1 API inputs:
cardProductId: Card product identifier configured during D1 onboarding.encryptedData.pan: Primary Account Number (PAN).encryptedData.exp: Expiry date, typicallyYYMM(for example,2906).
Optional D1 API inputs:
encryptedData.encodedName: End user name for Track 1, pre-encoded per ISO/IEC 7813 rules.encryptedData.cvv1: CVV1 value used when your discretionary data pattern includes thecvvtoken. If omitted, D1 computes it using CVK.paymentApplication.cvKeyIndex: CVK index used when computingcvv1.encryptedData.pvv: PIN Verification Value (PVV) used when your discretionary data pattern includes thepvvtoken. If omitted, D1 computes it using the PIN verification key (PVK).paymentApplication.pvKeyIndex: PIN verification key index used when computingpvv.
Optional track overrides:
trackData.track1: Full Track 1 value to use as-is.trackData.track2: Full Track 2 value to use as-is.trackData.track3: Full Track 3 value to use as-is.
Configuration in D1
serviceCode: 3‑digit service code used in Tracks 1 and 2.Discretionary data patterns per track (for example,
000000|cvv|000000).Use
cvvin the pattern to injectcvv1.Use
pvvin the pattern to injectpvv.
Key indexes (
cvKeyIndex,pvKeyIndex) available for computation.
Including pvv in discretionary data is not standard for magstripe tracks. Only enable it if explicitly required by your configuration and risk policies.
CVV1 is different from the Card security code (CSC, also known as CVV2). CVV1 appears on the magnetic stripe. CSC/CVV2 must never be stored on the card and is not part of the tracks.
Treat full track values as sensitive card data. Do not log them. Do not expose them to the end user.
Track 1 computation (alphanumeric)
Format
How D1 builds it
Use
trackData.track1if provided.Otherwise, compute using:
pan,exp,encodedNamefrom the APIserviceCodeconfigured in D1Track 1 discretionary data pattern configured in D1
cvv1if referenced by the pattern (cvvtoken)Use the provided
cvv1, or compute it via CVK (cvKeyIndex)
pvvif referenced by the pattern (pvvtoken)Use the provided
pvv, or compute it (pvKeyIndex)
Example
Inputs:
pan: 5413330089012345exp: 2906encodedName: DOE/ALICEserviceCode: 201 (configured in D1)Track 1 discretionary pattern:
000000|cvv|000000Computed
cvv1(viacvKeyIndex=3): 123
Result:
Discretionary data = 000000 + cvv1 + 000000 → 000000123000000.
Track 2 computation (numeric only)
Format
How D1 builds it
Use
trackData.track2if provided.Otherwise, compute using:
pan,expfrom the APIserviceCodeconfigured in D1Track 2 discretionary data pattern configured in D1
cvv1if referenced by the pattern (cvvtoken)pvvif referenced by the pattern (pvvtoken)
Example
Inputs:
pan: 5413330089012345exp: 2906serviceCode: 201 (configured in D1)Track 2 discretionary pattern:
00000|cvv|00000Computed
cvv1: 123
Result:
Discretionary data = 00000 + cvv1 + 00000 → 0000012300000.
Track 3 computation
Track 3 is uncommon in most card programs. Enable it only if your card product requires it.
Format
How D1 builds it
Use
trackData.track3if provided.Otherwise, compute using
panfrom the API and a Track 3 body configured in D1.
Example
pan: 5413330089012345body(configured in D1): 123456789012345
Result:
Last updated
Was this helpful?