> ## Documentation Index
> Fetch the complete documentation index at: https://doc-test-my.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Card IIN Information using IIN API

> Fetch customer card IIN information before payment initiation using the IIN API.

The Issuer Identification Number (IIN, also known as BIN) is the first 6 digits of a credit or debit card. Our IIN API provides all the details about a given IIN.

Using this API, you can get details about customers' cards even before the payment is initiated. This helps you to determine whether the payment should be allowed.

For example, if you do not want to accept credit card payments from customers, you can use this API to detect the customer's card type by checking the IIN. Based on the response, you can decide whether to allow the payment to proceed or not.

<Info>
  **Feature Request**

  This is an on-demand feature. Please raise a request with our [Support team](https://curlec.com/support/) to get this feature activated on your account.
</Info>

## Uses

You can use this API to:

* Check if the IIN of the card number entered by a customer is valid.
* Check if the IIN is eligible for different payment flows such as recurring and EMI.
* Get information about the card network, card type and issuing bank.
* Detect customer's card type.
* Fetch the actual card IIN for a given token IIN. This is currently supported for Visa and MasterCard.

## Supported Length of the IIN

Please make sure to pass the IIN with correct length as described in the table below:

| Network    | Card IINs     |
| ---------- | ------------- |
| Visa       | 6 to 8 digits |
| MasterCard | 6 to 8 digits |

## IIN Entity

<CodeGroup>
  ```json Entity theme={null}
  {
    "iin": "438628",
    "entity": "iin",
    "network": "Visa",
    "type": "credit",
    "sub_type": "business",
    "issuer_code": "HSBC",
    "issuer_name": "HSBC Bank",
    "international": false,
    "tokenised_iin": false,
    "card_iin": null,
    "emi": {
      "available": false
    },
    "recurring": {
      "available": true
    },
    "authentication_types": [
      {
        "type": "3ds"
      },
      {
        "type": "otp"
      }
    ]
  }
  ```
</CodeGroup>

`iin`
: `string` The Issuer Identification Number (IIN). The starting 6 digits of credit or debit card number. For example, `438628` or `438628111`.

`entity`
: `string` The name of the entity. Here, it is `iin`.

`network`
: `string` The card network for the given IIN. Possible values:

`type`
: `string` The card type for the given IIN. The card payment pricing may differ based on the card type. Possible values:

* `credit`
* `debit`
* `prepaid`
* `unknown`

`sub_type`
: `string` The card sub-type for the given IIN. The card payment pricing may differ based on the card sub-type. Possible values:

* `consumer`
* `business`
* `unknown`

`international`
: `boolean` Determines whether the card is international (issued outside India) or domestic. Possible values:

* `true`: Card issued outside India.
* `false`: Card issued within India.

`issuer_code`
: `string` The 4-character issuer code unique to each issuing bank. For example, `HSBC`.

`issuer_name`
: `string` The name of the issuing bank. Available for cards issued in India only. For example, `HSBC Bank`.

`recurring`
: `json object` A JSON object which provides information about the applicability of recurring payments on the IIN.

`available`
: `boolean` Determines whether the card is eligible for recurring payments or not. Possible values:

* `true`: IIN is eligible for recurring payments.
* `false`: IIN is not eligible for recurring payments.

`authentication_types`
: `array` Array which lists the possible authentication types for which the IIN is eligible. Possible values:

* `type: 3ds`: Indicates that the card IIN supports normal 3ds payments.
* `type: otp`: Indicates that the card IIN supports native OTP payments. Native OTP gives you flexibility to accept the OTP entered by the cardholder on your screen.

## Fetch IIN

The following API helps you get all the information about the IIN:

`GET /iins/:iin`

### Path Parameter

`id` *mandatory*
: `string` The first 6 digits of the customer's card number depending on the network.

#### 6-digit IINs

<CodeGroup>
  ```bash Curl theme={null}
  curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
  -X GET https://api.razorpay.com/v1/iins/438628/
  ```

  ```java Java theme={null}
  RazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");

  String tokenIin = "438628";
  Iin token = instance.iin.fetch(tokenIin);
  ```

  ```python Python theme={null}
  import razorpay
  client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))

  tokenIin = "438628"
  client.iin.fetch(tokenIin)
  ```

  ```php PHP theme={null}
  $api = new Api($key_id, $secret);

  $tokenIin = "438628";
  $api->iin->fetch($tokenIin);
  ```

  ```javascript Node.js theme={null}
  var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })

  var tokenIin = "438628";
  instance.iins.fetch(tokenIin)
  ```

  ```go Go theme={null}
  import ( razorpay "github.com/razorpay/razorpay-go" )
  client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")

  tokenIin := "438628"

  body, err := client.Iin.Fetch(tokenIin, nil, nil)
  ```

  ```json Response theme={null}
  {
    "iin": "438628",
    "entity": "iin",
    "network": "Visa",
    "type": "credit",
    "sub_type": "business",
    "issuer_code": "HSBC",
    "issuer_name": "HSBC Bank",
    "international": false,
    "emi": {
      "available": true
    },
    "recurring": {
      "available": true
    },
    "authentication_types": [
      {
        "type": "3ds"
      },
      {
        "type": "otp"
      },
      {
        "type": "otp_less_authentication"
      }
    ]
  }
  ```
</CodeGroup>

#### 9-digit IINs

## Error Handling

### Invalid IIN

The following error will be shown when the IIN is invalid:

<CodeGroup>
  ```json Error Response theme={null}
  {
    "error": {
      "code": "BAD_REQUEST_ERROR",
      "description": "IIN 000000 does not exist",
      "source": "merchant",
      "step": "NA",
      "reason": "iin_does_not_exist",
      "metadata": {}
    }
  }
  ```
</CodeGroup>

### Invalid IIN length

The following error will be shown when the length of IIN is invalid :

<CodeGroup>
  ```json Error Response theme={null}
  {
    "error": {
      "code": "BAD_REQUEST_ERROR",
      "description": "The requested IIN is a card IIN & should be 6 digits long.",
      "source": "business",
      "step": "NA",
      "reason": "invalid_iin_length",
      "metadata": {}
    }
  }
  ```
</CodeGroup>
