Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Magnetic stripe tracks

Magnetic stripe tracks (ISO/IEC 7813).

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, or trackData.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, typically YYMM (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 the cvv token. If omitted, D1 computes it using CVK.

  • paymentApplication.cvKeyIndex: CVK index used when computing cvv1.

  • encryptedData.pvv: PIN Verification Value (PVV) used when your discretionary data pattern includes the pvv token. If omitted, D1 computes it using the PIN verification key (PVK).

  • paymentApplication.pvKeyIndex: PIN verification key index used when computing pvv.

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 cvv in the pattern to inject cvv1.

    • Use pvv in the pattern to inject pvv.

  • Key indexes (cvKeyIndex, pvKeyIndex) available for computation.

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.

Track 1 computation (alphanumeric)

Format

How D1 builds it

  1. Use trackData.track1 if provided.

  2. Otherwise, compute using:

    • pan, exp, encodedName from the API

    • serviceCode configured in D1

    • Track 1 discretionary data pattern configured in D1

    • cvv1 if referenced by the pattern (cvv token)

      • Use the provided cvv1, or compute it via CVK (cvKeyIndex)

    • pvv if referenced by the pattern (pvv token)

      • Use the provided pvv, or compute it (pvKeyIndex)

Example

Inputs:

  • pan: 5413330089012345

  • exp: 2906

  • encodedName: DOE/ALICE

  • serviceCode: 201 (configured in D1)

  • Track 1 discretionary pattern: 000000|cvv|000000

  • Computed cvv1 (via cvKeyIndex=3): 123

Result:

Discretionary data = 000000 + cvv1 + 000000000000123000000.

Track 2 computation (numeric only)

Format

How D1 builds it

  1. Use trackData.track2 if provided.

  2. Otherwise, compute using:

    • pan, exp from the API

    • serviceCode configured in D1

    • Track 2 discretionary data pattern configured in D1

    • cvv1 if referenced by the pattern (cvv token)

    • pvv if referenced by the pattern (pvv token)

Example

Inputs:

  • pan: 5413330089012345

  • exp: 2906

  • serviceCode: 201 (configured in D1)

  • Track 2 discretionary pattern: 00000|cvv|00000

  • Computed cvv1: 123

Result:

Discretionary data = 00000 + cvv1 + 000000000012300000.

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

  1. Use trackData.track3 if provided.

  2. Otherwise, compute using pan from the API and a Track 3 body configured in D1.

Example

  • pan: 5413330089012345

  • body (configured in D1): 123456789012345

Result:

Last updated

Was this helpful?