# Check Source

## Check the Source

With this request, you should check the callback source and make sure it comes from FCF Pay.

You will receive the`unique_id` in the [deposit callback](https://api-docs.fcfpay.com/reference/api-requests-v1-deprecated/deposit-callback)*.*

{% tabs %}
{% tab title="cURL" %}

```
curl --location --request POST 'https://merchant.fcfpay.com/api/v1/check-source' \
--header 'Authorization: Bearer YOUR_LIVE_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
	"unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
}'
```

{% endtab %}

{% tab title="JavaScript" %}

```
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_LIVE_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://merchant.fcfpay.com/api/v1/check-source", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Node.js" %}

```
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://merchant.fcfpay.com/api/v1/check-source',
  'headers': {
    'Authorization': 'Bearer ',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
  })
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

{% endtab %}

{% tab title="PHP" %}

```
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://merchant.fcfpay.com/api/v1/check-source',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
  }',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer ',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

<table><thead><tr><th width="345.0526315789474">Field</th><th>Description</th></tr></thead><tbody><tr><td>unique_id</td><td>The unique id you mus get from deposit callback</td></tr><tr><td></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "https://merchant.fcfpay.com/api/v1/check-source"

payload = json.dumps({
  "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
})
headers = {
  'Authorization': 'Bearer YOUR_LIVE_API_KEY',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

## Check the source.

<mark style="color:green;">`POST`</mark> `https://merchant.fcfpay.com/api/v1/check-source`

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {{API\_KEY}} |

#### Request Body

| Name       | Type   | Description                       |
| ---------- | ------ | --------------------------------- |
| unique\_id | string | Got from deposit callback request |

{% tabs %}
{% tab title="200: OK Transaction exists" %}

```javascript
{
  "success": true,
  "data": {
    "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
  },
  "message": "Transaction exists."
}
```

{% endtab %}

{% tab title="200: OK Merchant Authentication problem!" %}

```javascript
{
  "success": false,
  "data": [],
  "message": "Merchant Authentication problem!"
}
```

{% endtab %}

{% tab title="401: Unauthorized The given data was invalid!" %}

```javascript
{
  "success": false,
  "data": {
    "test": "test"
  },
  "message": "The given data was invalid!",
  "errors": {
    "unique_id": [
      "The unique id field is required."
    ]
  }
}
```

{% endtab %}

{% tab title="401: Unauthorized Transaction does not exist!" %}

```javascript
{
  "success": false,
  "data": {
    "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0"
  },
  "message": "Transaction does not exist!"
}
```

{% endtab %}
{% endtabs %}
