# Set a PIN for a Full PAN Issuer
source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/pin-management/set-pin-for-full-pan-issuer/index.md

## Test case -- Success {#test-case--success}

This test case describes setting a PIN by sending a PIN block in ISO-0 format encrypted with the Zone PIN Key (ZPK).

Note: The test case does not describe the end-to-end payload encryption used for every API operation in the Sandbox environment. Refer to [Encryption](https://developer.mastercard.com/mastercard-processing-core/documentation/api-basics-section/encryption/index.md) for more information. For this test case, use the following information in the request:

<br />

|       Field        | Available value |
|--------------------|-----------------|
| `card_contract_id` | 70001           |
|                    | 70002           |
|                    | 70003           |
|                    | 70004           |
|                    | 70005           |

Note: To generate an encrypted value of the `newPinBlock` field, use the PAN/PIN and ZPK assigned to the `card_contract_id` value which you want to use in the request.

| card_contract _id |       PAN        | PIN  |                Zone PIN Key (ZPK)                |
|-------------------|------------------|------|--------------------------------------------------|
| 70001             | 5141576351968605 | 7580 | F94B8CD62A20B85AA9B8E06DB6B0BA6785EC029CB604E861 |
| 70002             | 5185410084016382 | 5336 | F94B8CD62A20B85AA9B8E06DB6B0BA6785EC029CB604E861 |
| 70003             | 5115795782050849 | 2360 | F94B8CD62A20B85AA9B8E06DB6B0BA6785EC029CB604E861 |
| 70004             | 5128839686355014 | 3011 | F94B8CD62A20B85AA9B8E06DB6B0BA6785EC029CB604E861 |
| 70005             | 5121876475234064 | 4041 | F94B8CD62A20B85AA9B8E06DB6B0BA6785EC029CB604E861 |

**Sample request**

`PUT /cards/70001/pin`

```JSON
{
  "cardExpiryDate": "3004",
  "cardSequenceNumber": "2",
  "newPinBlock": "EF52E5BCD3DAB693"
}
```

**Sample response**

`204`

## Test case -- Fail -- Invalid PIN block {#test-case--fail--invalid-pin-block}

This test case describes an attempt to set a PIN by sending an invalid PIN block.
**Sample request**

`PUT /cards/70001/pin`

```JSON
{
  "cardExpiryDate": "3004",
  "newPinBlock": "FFFFFFFFXX"
}
```

**Sample response**

`400`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "REQUEST_VALIDATION",
        "Description": "Invalid field newPinBlock value in object pinCreation. Validation error: Field contains incorrect hexadecimal value."
        "Recoverable": false,
      }
    ]
  }
}
```

## Test case -- Fail -- Incorrect Card expiry date {#test-case--fail--incorrect-card-expiry-date}

This test case describes an attempt to set a PIN by sending an invalid card expiry date.

For this test case, use the following information in the request:

|      Field       | Available value |
|------------------|-----------------|
| `cardExpiryDate` | 2101            |

**Sample request**

`POST /cards/70001/pins/verifications`

```JSON
{
  "cardExpiryDate": "2101",
  "newPinBlock": "EF52E5BCD3DAB693"
}
```

**Sample response**

`404`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "INVALID_EXPIRY_DATE",
        "Description": "Expiry date 2101 does not match for the card contract with id 70001.",
        "Recoverable": false
      }
    ]
  }
}
```

## Test case -- Fail -- Card contract is not active {#test-case--fail--card-contract-is-not-active}

This test case describes an attempt to set a PIN for a card contract that is not active.

For this test case, use the following information in the request:

| Path parameter | Available value |
|----------------|-----------------|
| `contract_id`  | 10002           |

**Sample request**

`PUT /cards/10002/pin`

```JSON
{
  "cardExpiryDate": "3004",
  "newPinBlock": "EF52E5BCD3DAB693"
}
```

**Sample response**

`400`

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "MASTERCARD PROCESSING",
        "ReasonCode": "CARD_CONTRACT_STATUS_IS_WRONG",
        "Description": "Card contract with id 10002 in wrong status to set PIN.",
        "Recoverable": false
      }
    ]
  }
}
```

