---
title: '4.3 BIN Lookup Service'
url: 'https://dev.paytr.com/en/direkt-api/bin-sorgulama-servisi'
markdown: 'https://dev.paytr.com/en/direkt-api/bin-sorgulama-servisi.md'
lang: en
date: '2026-11-29'
description: 'You can send a BIN number to access the detailed information of the card using that service. 1- A request is made to the BIN Lookup Service https://www.paytr.com/odeme/api/bin-detail along with BIN number of the card(The first 6 or 8 digits of the card number) and the fields that must be sent. Req…'
---

- [Türkçe](https://dev.paytr.com/direkt-api/bin-sorgulama-servisi)
- [English](https://dev.paytr.com/en/direkt-api/bin-sorgulama-servisi)

 [](#)  [ Getting Started with PayTR ](https://dev.paytr.com/en)     [ Direct API ](https://dev.paytr.com/en/direkt-api)      4.3 BIN Lookup Service    

# 4.3 BIN Lookup Service

You can send a BIN number to access the detailed information of the card using that service.

1- A request is made to the BIN Lookup Service https://www.paytr.com/odeme/api/bin-detail along with BIN number of the card(The first 6 or 8 digits of the card number) and the fields that must be sent.

**Required parameters for token creation**

| Field name / Type | Explanation | Compulsory | Limitations |
|---|---|---|---|
| bin\_number | The first 6 or 8 digits of the card number of the card to be questioned. Use 8 digits for maximum verification. | Yes | Maximum 8 digits. |
| merchant\_id | Store Number: Store number given to you by PAYTR | Yes | - |
| merchant\_salt | Merchant secret key | Yes | - |
| merchant\_key | Merchant password | Yes | - |

**Values to be sent in POST REQUEST content:**

| Variable / Type | Compulsory | Explanation |
|---|---|---|
| merchant\_id(integer) | Yes | Store Number: Store number given to you by PAYTR |
| bin\_number(string) | Yes | The first 6 or 8 digits of the card number of the card to be questioned. Use 8 digits for maximum verification. |
| paytr\_token(string) | Yes | paytr\_token: This value is the one you need to create to make sure the request is coming from you and that the values it contains have not changed. |

2- Your response to this request is returned in JSON format. a. If the BIN Number is not defined (For example, if it is a foreign card), the status value returns "failed". b. If the BIN number is defined, the status value returns as "success" with the information in the table below returns. c. If you have an error in the request, the status value returns "error". In this case, you should check the "err\_msg" for error details.

When the status value is successful, the returned values are in the table below.

| Variable / Type | Values | Explanation |
|---|---|---|
| status (string) | success, error or failed | Status: Result of the request (Response) |
| cardType (string) | credit / debit | credit / debit |
| businessCard (string) | y / n | Company Card: Whether the card is a company card or not |
| bank (string) | Example: Yapı Kredi | Bank: The bank of the card |
| brand (string) | Example: axess, bonus,cardfinans, combo,world, paraf, advantage,maximum,saglamkart | Program partners: (If the card is not included in a program partnership, the value will be none. In this case, installment payment can not be made with the card on PayTR) |
| schema (string) | VISA, MASTERCARD, AMEX, TROY, OTHER | Information on which scheme the card belongs to. (If it is not known which scheme the card belongs to, answer returns as OTHER) |
| bankCode (int) | Example: 0010 | Bank Code: Card bank code |
| allow\_non3d (string) | Y(yes) ve N(no) | Non-3D processing suitability result |

- [PHP](#bab5055b410)
- [PYTHON](#bab5055b411)
- [.NET](#bab5055b412)
- [NODEJS](#bab5055b413)

```Php
<?php

    $merchant_id    = 'XXXXXX';
    $merchant_key   = 'XXXXXX';
    $merchant_salt  = 'XXXXXX';

    $bin_number = "";

    $hash_str = $bin_number . $merchant_id . $merchant_salt;
    $paytr_token=base64_encode(hash_hmac('sha256', $hash_str, $merchant_key, true));
    $post_vals=array(
        'merchant_id'=>$merchant_id,
        'bin_number'=>$bin_number,
        'paytr_token'=>$paytr_token
    );

    $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/api/bin-detail");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1) ;
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);

    $result = @curl_exec($ch);

    if(curl_errno($ch))
        die("PAYTR BIN detail request timeout. err:".curl_error($ch));

    curl_close($ch);

    $result=json_decode($result,1);

    if($result['status']=='error')
        die("PAYTR BIN detail request error. Error:".$result['err_msg']);
    elseif($result['status']=='failed')
        die("BIN tanımlı değil. (Örneğin bir yurtdışı kartı)");
    else
        print_r($result);

?>

```

```python
# Python 3.6+

import base64
import hmac
import hashlib
import requests
import json

merchant_id = 'XXX'
merchant_key = b'XXX'
merchant_salt = 'XXX'

bin_number = 'XXXXXX'

hash_str = bin_number + merchant_id + merchant_salt
paytr_token = base64.b64encode(hmac.new(merchant_key, hash_str.encode(), hashlib.sha256).digest())

params = {
    'merchant_id': merchant_id,
    'bin_number': bin_number,
    'paytr_token': paytr_token
}

result = requests.post('https://www.paytr.com/odeme/api/bin-detail', params)
res = json.loads(result.text)

if res['status'] == 'error':
    print('PAYTR BIN detail request error. Error: ' + res['err_msg'])
elif res['status'] == 'failed':
    print('BIN tanımlı değil. (Örneğin bir yurtdışı kartı)')
else:
    print(result.text)

```

```c
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Collections.Specialized;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Web.Script.Serialization;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult GetBinDetail()
        {

            string merchant_id = "XXXXXX";
            string merchant_key = "XXXXXX";
            string merchant_salt = "XXXXXX";

            string bin_number = "";

            string Birlestir = string.Concat(bin_number, merchant_id, merchant_salt);
            HMACSHA256 hmac = new HMACSHA256(Encoding.UTF8.GetBytes(merchant_key));
            byte[] b = hmac.ComputeHash(Encoding.UTF8.GetBytes(Birlestir));
            string paytr_token = Convert.ToBase64String(b);

            NameValueCollection data = new NameValueCollection();
            data["merchant_id"] = merchant_id;
            data["bin_number"] = bin_number;
            data["paytr_token"] = paytr_token;

            using (WebClient client = new WebClient())
            {
                client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                byte[] result = client.UploadValues("https://www.paytr.com/odeme/api/bin-detail", "POST", data);
                string ResultAuthTicket = Encoding.UTF8.GetString(result);
                dynamic json = JValue.Parse(ResultAuthTicket);
                if (json.status == "success")
                {
                    Response.Write(json);
                }
                            else if (json.status == "failed")
                {
                    Response.Write("BIN tanımlı değil. (Örneğin bir yurtdışı kartı)");
                }
                            else if (json.status == "error")
                {
                    Response.Write("PAYTR BIN detail request error. Error:" + json.err_msg + "");
                }
            }

            return View();
        }
    }
}

```

```js
var request = require('request');
var crypto = require('crypto');
var express = require('express');
var app = express();

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

var merchant_id = 'XXXXXX';
var merchant_key = 'XXXXXX';
var merchant_salt = 'XXXXXX';

var bin_number = 'XXXXXX';

var paytr_token = crypto.createHmac('sha256', merchant_key).update(bin_number + merchant_id + merchant_salt).digest('base64');

app.get("/", function (req, res) {

var options = {
    'method': 'POST',
    'url': 'https://www.paytr.com/odeme/api/bin-detail',
    'headers': {
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    form: {
        'merchant_id': merchant_id,
        'bin_number': bin_number,
        'paytr_token': paytr_token,
    }
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
    var res_data = JSON.parse(body);

    if (res_data.status == 'success') {
        res.send(response.body);

    } else {
        res.end(response.body);
    }

});

});

var port = 3200;
app.listen(port, function () {
    console.log("Server is running. Port:" + port);
});

```

BIN Lookup Service sample codes[ **Click to download.**](https://dev.paytr.com/en/direkt-api/bin-sorgulama-servisi/PayTR_BIN_Sorgulama_Servisi.zip)

---

## Navigation

- Parent: [Direct API](https://dev.paytr.com/en/direkt-api.md)
- Previous: [4.2 Installment Rates Service](https://dev.paytr.com/en/direkt-api/taksit-sorgulama.md)
- Next: [B2B Entegrasyonu 1. Adım](https://dev.paytr.com/en/direkt-api/b2b-entegrasyonu.md)
