# PAN List API
source: https://developer.mastercard.com/unified-installments/documentation/testing/pan-list-api/index.md

## Create a PAN List and/or add PAN to a list {#create-a-pan-list-andor-add-pan-to-a-list}

|                            |                                                                                                                                                                           |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Company ID                 | 242666                                                                                                                                                                    |
| ICA                        | 19246                                                                                                                                                                     |
| Country                    | USA                                                                                                                                                                       |
| Account Range Start Number | 2303770003300000000                                                                                                                                                       |
| Account Range End Number   | 2303770003399999999                                                                                                                                                       |
| PANs for example           | 2303770003322342 2303770003334644 2303770003366422 2303770003368287 2303770003312053 2303770003350764 2303770003354337 2303770003354121 2303770003356183 2303770003341128 |

Using above test data, customers will be able to test the following endpoints on Sandbox:

## POST /consumers/pans/registrations {#post-consumerspansregistrations}

Using PANs belonging to above account range, customers can create PAN Lists.

### Test Case 1: Success-Register a new PAN list with both account range and valid PANs {#test-case-1-success-register-a-new-pan-list-with-both-account-range-and-valid-pans}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list name.  

The request body includes an account range.  

The request body includes a list of valid PANs.  

**THEN**: The PAN list is created and the PANs are registered.

##### Request Body {#request-body}

*Registrations with PAN list and PANs*
* JSON

```JSON
{
  "panListName": "MC Offers PAN List",
  "accountRange": {
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  },
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response}

*Registration Success Response*
* JSON

```JSON
{
  "successfulCount": "3",
  "failureCount": "0",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  }
}
```

### Test Case 2: Success-Register new PAN list with only account range and no PANs {#test-case-2-success-register-new-pan-list-with-only-account-range-and-no-pans}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list name.  

The request body includes an account range.  

The request body does not include a list of PANs.  

**THEN**: The PAN list is created.

##### Request Body {#request-body-1}

*Registrations with PAN list and account range*
* JSON

```JSON
{
  "panListName": "Christmas Offers PAN List",
  "accountRange": {
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  }
}
```

##### Response {#response-1}

*Registration Success Response*
* JSON

```JSON
{
  "successfulCount": "0",
  "failureCount": "0",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  }
}
```

### Test Case 3: Success-Register a new PAN list with only valid PANs but no account range {#test-case-3-success-register-a-new-pan-list-with-only-valid-pans-but-no-account-range}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list name.  

The request body includes a list of valid PANs.  

The request body does not include an account range.  

**THEN**: The PAN list is created and the PANs are registered.

##### Request Body {#request-body-2}

*Registrations with PAN list and PANs*
* JSON

```JSON
{
  "panListName": "MC Offers PAN List",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-2}

*Registration Partial Success Response*
* JSON

```JSON
{
  "successfulCount": "3",
  "failureCount": "0",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  }
}
```

### Test Case 4: Success-Register valid PANs to an existing PAN list {#test-case-4-success-register-valid-pans-to-an-existing-pan-list}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list ID.  

The request body includes a list of valid PANs.  

**THEN**: The PANs are registered to the existing PAN list.

##### Request Body {#request-body-3}

*Registration to existing PAN list*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-3}

*Registration Success Response*
* JSON

```JSON
{
  "successfulCount": "3",
  "failureCount": "0",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  }
}
```

### Test Case 5: Partial Success-Register a new PAN list with both account range and some valid PANs {#test-case-5-partial-success-register-a-new-pan-list-with-both-account-range-and-some-valid-pans}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list name.  

The request body includes an account range.  

The request body includes a list of PANs, some of which are invalid or already registered.  

**THEN**: The PAN list is created and the valid PANs are registered.

##### Request Body {#request-body-4}

*Registrations with PAN list and PANs*
* JSON

```JSON
{
  "panListName": "MC Offers PAN List",
  "accountRange": {
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  },
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-4}

*Registration Partial Success Response*
* JSON

```JSON
{
  "successfulCount": "1",
  "failureCount": "2",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  },
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004151208945",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      },
      {
        "pan": "2303770004133842092",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      }
    ]
  }
}
```

### Test Case 6: Partial Success-Register some valid PANs to an existing PAN list {#test-case-6-partial-success-register-some-valid-pans-to-an-existing-pan-list}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.  

The request body includes a PAN list ID.  

The request body includes a list of PANs, some of which are invalid or already registered.  

**THEN**: The PANs are registered to the existing PAN list.

##### Request Body {#request-body-5}

*Registration to existing PAN list*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-5}

*Registration Success Response*
* JSON

```JSON
{
  "successfulCount": "1",
  "failureCount": "2",
  "panList": {
    "panListId": "282365832930004992",
    "panListName": "Christmas Offers PAN List"
  },
  "accountRange": {
    "cid": "242666",
    "ica": "19246",
    "country": "USA",
    "accountRangeLow": "2303770004100000000",
    "accountRangeHigh": "2303770004199999999"
  },
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004151208945",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      },
      {
        "pan": "2303770004133842092",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      }
    ]
  }
}
```

### Test Case 7: Failure-Register a new PAN list with no account range and no PANs {#test-case-7-failure-register-a-new-pan-list-with-no-account-range-and-no-pans}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/registrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/registrations` endpoint.
The request body includes a PAN list name.  

The request body does not include an account range or PANs.  

**THEN**: No PAN list is created and no PANs are registered. A 400 response code and an invalid.data reason code are returned.

##### Request Body {#request-body-6}

*Registrations with PAN list no account range or PANs*
* JSON

```JSON
{
  "panListName": "MC Offers PAN List"
}
```

##### Response {#response-6}

*Registration Failure Response*
* JSON

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "mci-installments-consumer-api",
        "ReasonCode": "invalid.data: Either pans or Account Range",
        "Description": "must not be null or empty",
        "Recoverable": false,
        "Details": ""
      }
    ]
  }
}
```

## POST/consumers/pans/deregistrations {#postconsumerspansderegistrations}

Customers can remove PANs from previously added PAN list through `POST /consumers/pans/registrations` invocations.

### Test Case 1: Success-Deregister PANs from a PAN list (all PANs are invalid) {#test-case-1-success-deregister-pans-from-a-pan-list-all-pans-are-invalid}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/deregistrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the `POST /consumers/pans/deregistrations` endpoint.  

The request body includes a PAN list ID.  

The request body includes a list of PANs to deregister.  

**THEN**: The PANs are deregistered from the PAN list.

##### Request Body {#request-body-7}

*Deregistration with PANs*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-7}

*Deregistration Success Response*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "successfulCount": "3",
  "failureCount": "0"
}
```

### Test Case 2: Partial Success-Deregister some PANs from a PAN list (some PANs are invalid) {#test-case-2-partial-success-deregister-some-pans-from-a-pan-list-some-pans-are-invalid}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/deregistrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the POST /consumers/pans/deregistrations endpoint.  

The request body includes a PAN list ID.  

The request body includes a list of PANs to deregister, some of which are invalid or have already been deregistered.  

**THEN**: The valid PANs are deregistered from the PAN list.

##### Request Body {#request-body-8}

*Deregistration with PANs*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-8}

*Deregistration Partial Success Response*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "successfulCount": "2",
  "failureCount": "1",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004151208945",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      }
    ]
  }
}
```

### Test Case 3: No Success-Deregister no PANs from a PAN list (all PANs are invalid) {#test-case-3-no-success-deregister-no-pans-from-a-pan-list-all-pans-are-invalid}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/deregistrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the POST /consumers/pans/deregistrations endpoint.  

The request body includes a PAN list ID.  

The request body includes a list of PANs to deregister, all of which are invalid or have already been deregistered.  

**THEN**: No PANs are deregistered.

##### Request Body {#request-body-9}

*Deregistration with PANs*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618"
      },
      {
        "pan": "2303770004151208945"
      },
      {
        "pan": "2303770004133842092"
      }
    ]
  }
}
```

##### Response {#response-9}

*Deregistration Partial Success Response*
* JSON

```JSON
{
  "panListId": "282365832930004992",
  "successfulCount": "0",
  "failureCount": "3",
  "sensitiveData": {
    "pans": [
      {
        "pan": "2303770004183976618",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      },
      {
        "pan": "2303770004151208945",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      },
      {
        "pan": "2303770004133842092",
        "error": {
          "reasonCode": "invalid.pan",
          "description": "pan already present in list"
        }
      }
    ]
  }
}
```

### Test Case 4: Failure-Deregister from a PAN list with no PANs provided {#test-case-4-failure-deregister-from-a-pan-list-with-no-pans-provided}

**GIVEN** : The client has access to the Mastercard Installments API and has integrated their solution or application with the [POST /consumers/pans/deregistrations](https://developer.mastercard.com/unified-installments/documentation/api-reference/apis/index.md#apis) endpoint.  

**WHEN** : The client backend system makes a REST call to the POST /consumers/pans/deregistrations endpoint.  

The request body includes a PAN list ID.  

The request body does not include a list of PANs to deregister.  

**THEN**: No PANs are deregistered. A 400 response code and invalid.data reason code are returned.

##### Request Body {#request-body-10}

*Deregistration with no PANs*
* JSON

```JSON
{
  "panListId": "282365832930004992"
}
```

##### Response {#response-10}

*Deregistration Failure Response*
* JSON

```JSON
{
  "Errors": {
    "Error": [
      {
        "Source": "mci-installments-consumer-api",
        "ReasonCode": "invalid.data: pans",
        "Description": "pans must not be null or empty",
        "Recoverable": false,
        "Details": ""
      }
    ]
  }
}
```

