> ## Documentation Index
> Fetch the complete documentation index at: https://nextgen-docs.enfuce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Change PIN

This capability enables your cardholders to securely update their card PIN, later during the card lifecycle (after the initial card PIN is set during its manufacturing). This provides convenience and flexibility to the cardholders who manage their PIN through the issuer-provided channels (web and/or mobile applications), and who might not have access to ATMs that provide the PIN change option.

<Info>Changing PIN does not initiate the embossing process as the plastic/physical card is already manufactured. </Info>

## Use Cases

A cardholder can change their PIN in any of the following scenarios:

* They receive a new card with a default PIN; they want to change the initial PIN to something of their preference.
* The cardholder wants to change their PIN some time in future for personal security or change in preference.

## Step-by-Step Guidance

<Note>
  <ul>
    <li>The process is similar to the set PIN function. However, it includes an additional check to ensure that a PIN is already existing for the card.</li>
    <li>The PIN is changed only for the specified card version with an encrypted PIN block in ISO format. If the card version is not specified, the PIN is changed for the latest version, by default.</li>
    <li>For multi-application cards, the PIN is changed for all the cards included within the main application.</li>
  </ul>
</Note>

<Steps>
  <Step title="First Step">
    The cardholder is successfully authenticated in the issuer-provided mobile or web application.
  </Step>

  <Step title="Second Step">
    The cardholder enters a PIN for their card.

    <Note>
      The PIN must meet the complexity requirements. The operation cannot be completed if the PIN is weak – a weak PIN is easy to guess; it includes simple sequences, consecutive or repeated digits, or common patterns. These PINs are blocked for security reasons. The exact list of weak PINs is not disclosed and is updated over time to counter security breaches.
    </Note>
  </Step>

  <Step title="Third Step">
    Javascript creates the PIN block for the PIN:

    1. Generates the PIN block in ISO Format 1.

    <div style={{ marginLeft: '30px', marginBottom: '15px' }}>
      <strong>Sample Format</strong>:<br />
      `< Format Version >< PIN Length >< PIN >< random HEX digits to fill eight bytes >`
    </div>

    <div style={{ marginLeft: '30px', marginTop: '15px', marginBottom: '15px' }}>
      <strong>Example</strong>:<br />
      `version = 1, PIN length = 4, PIN = 7856, random hex = 3CB5055865, PIN block = 1478563CB5055865 (hex, 8 bytes)`
    </div>

    2. Encrypts the clear PIN block using the pre-shared double-length 3DES ZPK (Zone PIN Key).
    3. Converts the encrypted PIN block to an uppercase hexadecimal string.
  </Step>

  <Step title="Fourth Step">
    Send a request to the [Change PIN](https://nextgen-docs.enfuce.com/api/pin/change-pin) endpoint.
  </Step>

  <Step title="Fifth Step">
    If the endpoint request is valid, Enfuce changes the PIN for the specified card version.
  </Step>

  <Step title="Sixth Step">
    Return a HTTP response code to indicate whether the operation has succeeded or failed.
  </Step>

  <Step title="Seventh Step">
    If the operation is successful, Enfuce updates the card PIN, and the result is displayed to the cardholder.
  </Step>
</Steps>
