# Intro

Introduction to FCFpay API

Welcome to the FCFpay API documentation.

In this document we will take you through the process of making requests to FCF Pay Merchant's API so you can set-up a custom installation on your website, to allow your customers to pay you with cryptocurrencies.

FCF Pay can be integrated into any system using the API calls.

Dive a little deeper and start exploring our API reference to get an idea of everything that's possible with the API:

{% content-ref url="/pages/kFIxQzZ54s7mbq9cKGiQ" %}
[API Requests - V2](/reference/api-requests-v2)
{% endcontent-ref %}


# Quick Start

Getting an API token to make requests.

## Authentication

In order to call most of the API endpoints, one needs to obtain an **API\_KEY**. This token is currently obtainable by authenticating yourself to the system.\
The section below describes how to do that.

Once you have obtained your **API\_KEY**, you must include it in all requests that require authentication. You do so by adding a `Authorization` header to the request with the value `Bearer <API_KEY>` as seen in the example on the right.

{% hint style="info" %}
Some API requests are not actually just API endpoints, but the webhook requests, which will be sent to the URL provided by you. So there is not stuff about authentication.
{% endhint %}

## Get an API token

> Note: Please keep in mind, that anytime you must use the API key as a Bearer token.

> For each API request you need to have a token. For getting a token, you need to login to your merchant's dashboard. In case when you don't have an account, you can register here <https://merchant.fcfpay.com/register>.

After logging in to the account, you can retrieve a token by creating a new project in <https://merchant.fcfpay.com/admin/projects/create>.

![Screen taken from development environment, so there is a dummy data just for example.](https://1945871046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3ZdalD0o3BV7ztrYg74F%2Fuploads%2FCpycCSNd6Wmo7PMJSlt7%2FueKkBBe.png?alt=media\&token=519c5b18-3832-40ef-85b0-4ae49a2c6ca3)

Note: keep the token (API key) in a safe place.


# API Requests - V2

Currently only valid for sandbox.fcfpay.com. Will be added to live environment in W3 of July.

## Environments

The following environments are available:

| Environment | Merchant URL                         | Checkout URL                          |
| ----------- | ------------------------------------ | ------------------------------------- |
| Sandbox     | <https://sandbox.fcfpay.com/api/v2>  | <https://checkout-sandbox.fcfpay.com> |
| Production  | <https://merchant.fcfpay.com/api/v2> | <https://checkout.fcfpay.com>         |

For easy integration, you may access Postman documentation and clone the collection: <https://documenter.getpostman.com/view/20701275/UyrEhaiN>

You can then add a new environment for Sandbox, if needed.

{% hint style="info" %}
All the API endpoints in the documentation containing the Production environment URL, so for testing you can use the Sandbox.

To use sandbox, you must create an account at <https://sandbox.fcfpay.com/register> and se the appropriate testnet for each token.
{% endhint %}

## Create Order

{% content-ref url="/pages/3rii7GZtuS5PA2QAkC0F" %}
[Create Order](/reference/api-requests-v2/create-order)
{% endcontent-ref %}

## Deposit Callback

{% content-ref url="/pages/Fr9qbibrk6bcmYG6fKjc" %}
[Deposit Callback](/reference/api-requests-v2/deposit-callback)
{% endcontent-ref %}


# Create Order

Create an order

## Creating a new order

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

```
curl --location -g --request POST '{{BASE_URL}}/v2/create-order' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
	"domain": "yourdomain.com",
	"order_id": "Test123",
    "user_id": "1",
	"amount": "100",
	"currency_name": "EUR",
    "order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "items": {
			"1": {
				"Item Name": "Test Item 1",
                "Quantity":"1",
				"Price": 10,
                "Total":"12",
			},
			"2": {
				"Item Name": "Test Item 2",
				"Price": 20
			}
		}
}'
```

{% endtab %}

{% tab title="JavaScript" %}

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

var raw = "{\r\n	\"domain\": \"yourdomain.com\",\r\n	\"order_id\": \"Test123\",\r\n    \"user_id\": \"1\",\r\n	\"amount\": \"100\",\r\n	\"currency_name\": \"EUR\",\r\n    \"order_date\": \"2022-04-26\",\r\n	\"redirect_url\": \"https://yourdomain.com/thank-you/\",\r\n    \"items\": {\r\n			\"1\": {\r\n				\"Item Name\": \"Test Item 1\",\r\n                \"Quantity\":\"1\",\r\n				\"Price\": 10,\r\n                \"Total\":\"12\",\r\n			},\r\n			\"2\": {\r\n				\"Item Name\": \"Test Item 2\",\r\n				\"Price\": 20\r\n			}\r\n		}\r\n}";

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

fetch("{{BASE_URL}}/v2/create-order", 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': '{{BASE_URL}}/v2/create-order',
  'headers': {
    'Authorization': 'Bearer {{API_KEY}}',
    'Content-Type': 'application/json'
  },
  body: '{\r\n	"domain": "yourdomain.com",\r\n	"order_id": "Test123",\r\n    "user_id": "1",\r\n	"amount": "100",\r\n	"currency_name": "EUR",\r\n    "order_date": "2022-04-26",\r\n	"redirect_url": "https://yourdomain.com/thank-you/",\r\n    "items": {\r\n			"1": {\r\n				"Item Name": "Test Item 1",\r\n                "Quantity":"1",\r\n				"Price": 10,\r\n                "Total":"12",\r\n			},\r\n			"2": {\r\n				"Item Name": "Test Item 2",\r\n				"Price": 20\r\n			}\r\n		}\r\n}'

};
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 => '%7B%7BBASE_URL%7D%7D/v2/create-order',
  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 =>'{
	"domain": "yourdomain.com",
	"order_id": "Test123",
    "user_id": "1",
	"amount": "100",
	"currency_name": "EUR",
    "order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "items": {
			"1": {
				"Item Name": "Test Item 1",
                "Quantity":"1",
				"Price": 10,
                "Total":"12",
			},
			"2": {
				"Item Name": "Test Item 2",
				"Price": 20
			}
		}
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{API_KEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "{{BASE_URL}}/v2/create-order"

payload = "{\r\n\t\"domain\": \"yourdomain.com\",\r\n\t\"order_id\": \"Test123\",\r\n    \"user_id\": \"1\",\r\n\t\"amount\": \"100\",\r\n\t\"currency_name\": \"EUR\",\r\n    \"order_date\": \"2022-04-26\",\r\n\t\"redirect_url\": \"https://yourdomain.com/thank-you/\",\r\n    \"items\": {\r\n\t\t\t\"1\": {\r\n\t\t\t\t\"Item Name\": \"Test Item 1\",\r\n                \"Quantity\":\"1\",\r\n\t\t\t\t\"Price\": 10,\r\n                \"Total\":\"12\",\r\n\t\t\t},\r\n\t\t\t\"2\": {\r\n\t\t\t\t\"Item Name\": \"Test Item 2\",\r\n\t\t\t\t\"Price\": 20\r\n\t\t\t}\r\n\t\t}\r\n}"
headers = {
  'Authorization': 'Bearer {{API_KEY}}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

| Field          | Description                                                 | Example                                                                                                                              |
| -------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| domain         | Your domain name                                            | "yourdomain.com"                                                                                                                     |
| order\_id      | The `id` of the order                                       | "3"                                                                                                                                  |
| user\_id       | The user's ID (optional)                                    | "1"                                                                                                                                  |
| amount         | The amount of the order                                     | "10"                                                                                                                                 |
| currency\_name | The ISO-4217 currency                                       | "USD"                                                                                                                                |
| order\_date    | The date of the order                                       | "2022-04-26"                                                                                                                         |
| redirect\_url  | The page where you want to redirect users after the payment | "<https://yourdomain.com/thank-you/>"                                                                                                |
| items          | List of items in JSON format                                | { "1": { "Item Name": "Test Item 1", "Quantity":"1", "Price": 10, "Total":"12" }, "2": { "Item Name": "Test Item 2", "Price": 20 } } |

## Create an order.

<mark style="color:green;">`POST`</mark> `https://merchant.fcfpay.com/api/v2/create-order`

Creates a new order.

#### Request Body

| Name                                             | Type    | Description                       |
| ------------------------------------------------ | ------- | --------------------------------- |
| domain<mark style="color:red;">\*</mark>         | string  | domain host of the order          |
| order\_id<mark style="color:red;">\*</mark>      | string  | The `id` of the order as a string |
| amount<mark style="color:red;">\*</mark>         | decimal | The amount as a string            |
| currency\_name<mark style="color:red;">\*</mark> | string  | The ISO-4217 currency             |
| redirect\_url<mark style="color:red;">\*</mark>  | string  | The URL where will redirected     |
| order\_date                                      | string  | The date with "YYYY-MM-DD" format |
| user\_id                                         | String  | The `id` of the user as a string  |
| items                                            | JSON    | List of Items                     |

{% tabs %}
{% tab title="200 Order successfully created" %}

```javascript
{
    "success": true,
    "data": {
        "checkout_page_url": "https://checkout-sandbox.fcfpay.com/pay/JDJ5JDEwJGNFWHNualp6NnFydDNNZzhkVUJwN2VILkJkTko1RmFTZ1ZVQVRCVWxqSVlxUy83YzRwTFou",
        "payment_status": "waiting"
    },
    "message": "Order successfully created. Waiting for the payment."
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API Key" %}

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

{% endtab %}
{% endtabs %}

After order creation, our system will send you a checkout page URL. You should redirect your customers to that URL.

If you send information about items, this will be displayed on the checkout page:

<figure><img src="https://1945871046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3ZdalD0o3BV7ztrYg74F%2Fuploads%2Fel9VO02wbEK76IWkrQty%2Fimage.png?alt=media&amp;token=069be69f-0864-4dc9-b9f4-ecc92c078d87" alt=""><figcaption></figcaption></figure>


# Create Invoice

Create an Invoice

## Creating a new Invoice

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

```
curl --location -g --request POST '{{BASE_URL}}/v2/create-invoice' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "api Invoice test",
    "invoice_number": "1234",
    "subject":   "API test",
    "description": "Rent for Q1",
    "amount": 30,
    "currency_name": "USD",
    "items": {
		"1": {
			"name": "Test Item 1",
            "Quantity":"1",
			"price": 10
		},
		"2": {
			"name": "Test Item 2",
			"price": 20
		}
	}
}'
```

{% endtab %}

{% tab title="JavaScript" %}

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

var raw = JSON.stringify({
  "name": "api Invoice test",
  "invoice_number": "1234",
  "subject": "API test",
  "description": "Rent for Q1",
  "amount": 30,
  "currency_name": "USD",
  "items": {
    "1": {
      "name": "Test Item 1",
      "Quantity": "1",
      "price": 10
    },
    "2": {
      "name": "Test Item 2",
      "price": 20
    }
  }
});

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

fetch("{{BASE_URL}}/v2/create-invoice", 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': '{{BASE_URL}}/v2/create-invoice',
  'headers': {
    'Authorization': 'Bearer {{API_KEY}}',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "name": "api Invoice test",
    "invoice_number": "1234",
    "subject": "API test",
    "description": "Rent for Q1",
    "amount": 30,
    "currency_name": "USD",
    "items": {
      "1": {
        "name": "Test Item 1",
        "Quantity": "1",
        "price": 10
      },
      "2": {
        "name": "Test Item 2",
        "price": 20
      }
    }
  })

};
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 => '%7B%7BBASE_URL%7D%7D/v2/create-invoice',
  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 =>'{
    "name": "api Invoice test",
    "invoice_number": "1234",
    "subject":   "API test",
    "description": "Rent for Q1",
    "amount": 30,
    "currency_name": "USD",
    "items": {
		"1": {
			"name": "Test Item 1",
            "Quantity":"1",
			"price": 10
		},
		"2": {
			"name": "Test Item 2",
			"price": 20
		}
	}
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{API_KEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "{{BASE_URL}}/v2/create-invoice"

payload = json.dumps({
  "name": "api Invoice test",
  "invoice_number": "1234",
  "subject": "API test",
  "description": "Rent for Q1",
  "amount": 30,
  "currency_name": "USD",
  "items": {
    "1": {
      "name": "Test Item 1",
      "Quantity": "1",
      "price": 10
    },
    "2": {
      "name": "Test Item 2",
      "price": 20
    }
  }
})
headers = {
  'Authorization': 'Bearer {{API_KEY}}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

| Field           | Description                                                    | Example                                                                                                      |
| --------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| name            | Name of your customer                                          | "API Invoice test"                                                                                           |
| invoice\_number | The number of the invoice (optional). Can accept any character | "1234"                                                                                                       |
| subject         | Subject as you'd like it to appear                             | "API test"                                                                                                   |
| description     | Description of items in the invoice                            | "Rent for Q1"                                                                                                |
| amount          | The amount as a string                                         | "100.05"                                                                                                     |
| currency\_name  | The ISO-4217 currency                                          | "USD"                                                                                                        |
| items           | List of items in JSON format                                   | { "1": { "name": "Test Item 1", "Quantity":"1", "price": 10 }, "2": { "name": "Test Item 2", "price": 20 } } |

## Create an invoice.

<mark style="color:green;">`POST`</mark> `https://merchant.fcfpay.com/api/v2/create-invoice`

Creates a new invoice.

#### Request Body

| Name                                          | Type    | Description                         |
| --------------------------------------------- | ------- | ----------------------------------- |
| name<mark style="color:red;">\*</mark>        | string  | Name of your customer               |
| invoice\_number                               | string  | The invoice number                  |
| amount<mark style="color:red;">\*</mark>      | decimal | The amount                          |
| description<mark style="color:red;">\*</mark> | string  | Description of items in the invoice |
| subject                                       | String  | Subject as you'd like it to appear  |

{% tabs %}
{% tab title="200 Order successfully created" %}

```javascript
{
    "success": true,
    "data": {
        "checkout_page_url": "https://checkout.fcfpay.com/pay/JDJ5JDEwJG1rVldXaGVtTVZsTHZUbjkxUFJmSE9QQURvQzVjUDlucU9zQVEyUWo5SWNGRWs0Lkx3bFRP",
        "payment_status": "waiting"
    },
    "message": "Invoice successfully created. Waiting for the payment."
}
```

{% endtab %}

{% tab title="401: Unauthorized Invalid API Key" %}

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

{% endtab %}
{% endtabs %}

After order creation, our system will send you a checkout page URL. You should redirect your customers to that URL.

If you send information about items, this will be displayed on the checkout page:

<figure><img src="https://1945871046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3ZdalD0o3BV7ztrYg74F%2Fuploads%2FgK8mnbv486em1QpBYxqb%2Fimage.png?alt=media&amp;token=d42f8878-164c-4c79-a19d-62a96539e70e" alt=""><figcaption></figcaption></figure>


# Deposit Callback

Webhook after receving payment.

## Deposit Callback

In this step, we are sending you a webhook with the status of the payment to your provided URL in the FCF Pay dashboard as a project callback URL.&#x20;

This webhook happens when you receive payment.

The request has a JSON body value like this:

```
{
  "success": true,
  "data": {
    "type":"deposit",
    "order_id": "Test123"
  },
  "message": "Payment Received"
}
```

| Field     | Description                                |
| --------- | ------------------------------------------ |
| type      | Callback type                              |
| order\_id | The order\_id that has received a payment. |


# Check Order

Get order information

After creating the order you can make a "check-order" request to check if the order was paid or not. You will receive all payments details in a list.

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

```
curl --location --request POST 'https://sandbox.fcfpay.com/api/v2/check-order' \
--header 'Authorization: Bearer YOUR_SANDBOX_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_id": "Test123"
}'
```

{% endtab %}

{% tab title="JavaScript" %}

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

var raw = JSON.stringify({
  "order_id": "Test123"
});

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

fetch("https://sandbox.fcfpay.com/api/v2/check-order", 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://sandbox.fcfpay.com/api/v2/check-order',
  'headers': {
    'Authorization': 'Bearer "YOUR_SANDBOX_API_KEY"',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "order_id": "Test123"
  })

};
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://sandbox.fcfpay.com/api/v2/check-order',
  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 =>'{
    "order_id": "Test123"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer "YOUR_SANDBOX_API_KEY"',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "https://sandbox.fcfpay.com/api/v2/check-order"

payload = json.dumps({
  "order_id": "Test123"
})
headers = {
  'Authorization': 'Bearer "YOUR_SANDBOX_API_KEY"',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

## Check Order

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

#### Query Parameters

| Name                                        | Type   | Description                    |
| ------------------------------------------- | ------ | ------------------------------ |
| order\_id<mark style="color:red;">\*</mark> | string | The Order ID you want to check |

{% tabs %}
{% tab title="200: OK Call successful, unpaid" %}

```javascript
{
    "success": true,
    "data": {
        "order_id": "3x101",
        "user_id": "1",
        "txs": [],
        "order_amount": "10.00",
        "total_fiat_amount": "",
        "fiat_currency": "USD"
    },
    "message": "Successfully fetched."
}
```

{% endtab %}

{% tab title="200: OK Call successful, 1st payment received" %}

```javascript
{
    "success": true,
    "data": {
        "order_id": "Test123",
        "user_id": "1",
        "order_amount": "100.00",
        "total_fiat_amount": "32.92",
        "fiat_currency": "EUR",
        "txs": [
            {
                "deposited": true,
                "txid": "0x278859d371bd6084963db80ba066fc891fe006047b0dc5c4929efff35918052c",
                "confirm_blocks": 24,
                "status": "deposited",
                "amount_usd": "33.89",
                "fiat_amount": "32.92",
                "fiat_currency": "EUR",
                "amount": "150000000000000000",
                "currency": "BSC",
                "fees": "210000000000000",
                "decimal": 18,
                "fee_decimal": 18,
                "date": "Jul 05 2022 12:24:44"
            }
        ]
    },
    "message": "Successfully fetched."
}
```

{% endtab %}

{% tab title="200: OK Call successful, multiple payments received" %}

```javascript
{
    "success": true,
    "data": {
        "order_id": "Test123",
        "user_id": "1",
        "order_amount": "100.00",
        "total_fiat_amount": "54.75",
        "fiat_currency": "EUR",
        "txs": [
            {
                "deposited": true,
                "txid": "0x278859d371bd6084963db80ba066fc891fe006047b0dc5c4929efff35918052c",
                "confirm_blocks": 24,
                "status": "deposited",
                "amount_usd": "33.89",
                "fiat_amount": "33.10",
                "fiat_currency": "EUR",
                "amount": "150000000000000000",
                "currency": "BSC",
                "fees": "210000000000000",
                "decimal": 18,
                "fee_decimal": 18,
                "date": "Jul 05 2022 03:02:35"
            },
            {
                "deposited": true,
                "txid": "0x2d54bfbfaf5fcd36a3ebb2400809b08d72defce9f121b3d30cb0bad57d23377c",
                "confirm_blocks": 22,
                "status": "deposited",
                "amount_usd": "22.47",
                "fiat_amount": "21.94",
                "fiat_currency": "EUR",
                "amount": "100000000000000000",
                "currency": "BSC",
                "fees": "210000000000000",
                "decimal": 18,
                "fee_decimal": 18,
                "date": "Jul 05 2022 03:02:35"
            }
        ]
    },
    "message": "Successfully fetched."
}
```

{% endtab %}

{% tab title="200: OK Call successful, order doesn't exist" %}

```javascript
{
    "success": false,
    "message": "",
    "data": "Order does not exists"
}
```

{% endtab %}
{% endtabs %}


# Check Orders

Get order information

You can make a "check-orders" request to check the payment status of multiple orders.

If there is a list of orders and from these one or more are not found, this API call will not return data for the order\_ids that were not found

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

```
curl --location --request POST 'https://sandbox.fcfpay.com/api/v2/check-orders' \
--header 'Authorization: Bearer YOUR_SANDBOX_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_ids": ["Test123","3x101","Test12"]
}'
```

{% endtab %}

{% tab title="JavaScript" %}

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

var raw = JSON.stringify({
  "order_ids": [
    "Test123",
    "3x101",
    "Test12"
  ]
});

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

fetch("https://sandbox.fcfpay.com/api/v2/check-orders", 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://sandbox.fcfpay.com/api/v2/check-orders',
  'headers': {
    'Authorization': 'Bearer "YOUR_SANDBOX_API_KEY"',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "order_ids": [
      "Test123",
      "3x101",
      "Test12"
    ]
  })

};
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://sandbox.fcfpay.com/api/v2/check-orders',
  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 =>'{
    "order_ids": ["Test123","3x101","Test12"]
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer "YOUR_SANDBOX_API_KEY"',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "https://sandbox.fcfpay.com/api/v2/check-orders"

payload = json.dumps({
  "order_ids": [
    "Test123",
    "3x101",
    "Test12"
  ]
})
headers = {
  'Authorization': 'Bearer "YOUR_SANDBOX_API_KEY"',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

## Check Order

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

#### Query Parameters

| Name                                         | Type  | Description                     |
| -------------------------------------------- | ----- | ------------------------------- |
| order\_ids<mark style="color:red;">\*</mark> | array | The Order IDs you want to check |

{% tabs %}
{% tab title="200: OK Call successful" %}

```javascript
{
    "success": true,
    "data": {
        "Test123": {
            "order_id": "Test123",
            "user_id": "1",
            "order_amount": 0,
            "total_fiat_amount": "54.75",
            "fiat_currency": "EUR",
            "txs": [
                {
                    "deposited": true,
                    "txid": "0x278859d371bd6084963db80ba066fc891fe006047b0dc5c4929efff35918052c",
                    "confirm_blocks": 24,
                    "status": "deposited",
                    "amount_usd": "33.89",
                    "fiat_amount": "33.10",
                    "fiat_currency": "EUR",
                    "amount": "150000000000000000",
                    "currency": "BSC",
                    "fees": "210000000000000",
                    "decimal": 18,
                    "fee_decimal": 18,
                    "date": "Jul 05 2022 03:02:35"
                },
                {
                    "deposited": true,
                    "txid": "0x2d54bfbfaf5fcd36a3ebb2400809b08d72defce9f121b3d30cb0bad57d23377c",
                    "confirm_blocks": 22,
                    "status": "deposited",
                    "amount_usd": "22.47",
                    "fiat_amount": "21.94",
                    "fiat_currency": "EUR",
                    "amount": "100000000000000000",
                    "currency": "BSC",
                    "fees": "210000000000000",
                    "decimal": 18,
                    "fee_decimal": 18,
                    "date": "Jul 05 2022 03:02:35"
                }
            ]
        },
        "3x101": {
            "order_id": "3x101",
            "user_id": "1",
            "order_amount": 0,
            "total_fiat_amount": 0,
            "fiat_currency": "USD",
            "txs": []
        }
    },
    "message": "Successfully fetched."
2
```

{% endtab %}

{% tab title="404: Not Found Order id not found" %}

```javascript
{
    "success": false,
    "message": "",
    "data": "Something went wrong!"
}
```

{% endtab %}
{% endtabs %}


# API Requests - V1 - deprecated!

Will be deprecated in August 2022

## Environments

The following environments are available:

| Environment | Merchant URL | Checkout URL                          |
| ----------- | ------------ | ------------------------------------- |
| Sandbox     | ---------    | <https://checkout-sandbox.fcfpay.com> |
| Production  | ---------    | <https://checkout.fcfpay.com>         |

For easy integration, you may access Postman documentation and clone the collection: <https://documenter.getpostman.com/view/20701275/UyrEhaiN>

You can then add a new environment for Sanbox, if needed.

{% hint style="info" %}
All the API endpoints in the documentation containing the Production environment URL, so for testing you can use the Sandbox.

To use sandbox, you must create an account at <https://sandbox.fcfpay.com/register> and se the appropriate testnet for each token.
{% endhint %}

## Create Order

{% content-ref url="/pages/H3XR6AnRHMrqoqxEsUY2" %}
[Create Order](/reference/api-requests-v1-deprecated/create-order)
{% endcontent-ref %}

## Deposit Callback

{% content-ref url="/pages/UdGVkyTssetfQXaabZEw" %}
[Deposit Callback](/reference/api-requests-v1-deprecated/deposit-callback)
{% endcontent-ref %}

## Check Source

{% content-ref url="/pages/IM7H1ZYJgbe2HR73JC7w" %}
[Check Source](/reference/api-requests-v1-deprecated/check-source)
{% endcontent-ref %}


# Create Order

Create an order

## Creating a new order

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

```
curl --location --request POST 'https://merchant.fcfpay.com/api/v1/create-order' \
--header 'Authorization: Bearer YOUR_LIVE_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
	"domain": "yourdomain.com",
	"order_id": "3",
    	"user_id": "1",
	"amount": "10",
	"currency_name": "USD",
	"order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
}'
```

{% 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({
  "domain": "yourdomain.com",
  "order_id": "3",
  "user_id": "1",
  "amount": "10",
  "currency_name": "USD",
  "order_date": "2022-04-26",
  "redirect_url": "https://yourdomain.com/thank-you/",
  "check_source_url": "https://yourdomain.com/api/v1/check-order"
});

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

fetch("https://merchant.fcfpay.com/api/v1/create-order", 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/create-order',
  'headers': {
    'Authorization': 'Bearer YOUR_LIVE_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "domain": "yourdomain.com",
    "order_id": "3",
    "user_id": "1",
    "amount": "10",
    "currency_name": "USD",
    "order_date": "2022-04-26",
    "redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
  })

};
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/create-order',
  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 =>'{
	"domain": "yourdomain.com",
	"order_id": "3",
    "user_id": "1",
	"amount": "10",
	"currency_name": "USD",
	"order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer YOUR_LIVE_API_KEY',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "https://merchant.fcfpay.com/api/v1/create-order"

payload = json.dumps({
  "domain": "yourdomain.com",
  "order_id": "3",
  "user_id": "1",
  "amount": "10",
  "currency_name": "USD",
  "order_date": "2022-04-26",
  "redirect_url": "https://yourdomain.com/thank-you/",
  "check_source_url": "https://yourdomain.com/api/v1/check-order"
})
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 %}

| Field              | Description                                                     | Example                                       |
| ------------------ | --------------------------------------------------------------- | --------------------------------------------- |
| domain             | Your domain name                                                | "yourdomain.com"                              |
| order\_id          | The `id` of the order                                           | "3"                                           |
| user\_id           | The user's ID (optional)                                        | "1"                                           |
| amount             | The amount of the order                                         | "10"                                          |
| currency\_name     | The ISO-4217 currency                                           | "USD"                                         |
| order\_date        | The date of the order                                           | "2022-04-26"                                  |
| redirect\_url      | The page where you want to redirect users after the payment     | "<https://yourdomain.com/thank-you/>"         |
| check\_source\_url | Must be return true or false (not required for current version) | "<https://yourdomain.com/api/v1/check-order>" |

## Create an order.

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

Creates a new order.

#### Request Body

| Name                                             | Type    | Description                       |
| ------------------------------------------------ | ------- | --------------------------------- |
| domain<mark style="color:red;">\*</mark>         | string  | domain host of the order          |
| order\_id<mark style="color:red;">\*</mark>      | string  | The `id` of the order as a string |
| amount<mark style="color:red;">\*</mark>         | decimal | The amount as a string            |
| currency\_name<mark style="color:red;">\*</mark> | string  | The ISO-4217 currency             |
| redirect\_url<mark style="color:red;">\*</mark>  | string  | The URL where will redirected     |
| order\_date                                      | string  | The date with "YYYY-MM-DD" format |
| check\_source\_url                               | string  | The URL of source                 |
| user\_id                                         | String  | The `id` of the user as a string  |

{% tabs %}
{% tab title="200 Order successfully created" %}

```javascript
{
  "success": true,
  "data": {
    "checkout_page_url": "https://checkout.fcfpay.com/JDJ5JDEwJFB2WjFLZldnbEd0R2JRbWNKOS5Lci5SU1FIVkdSY0ZLQktSZkl2Q0FjclRLdlJXYUZ3VWF5",
    "payment_status": "waiting"
  },
  "message": "Order successfully created. Waiting for the payment."
}
```

{% endtab %}
{% endtabs %}

After order creation, our system will send you a checkout page URL. You should redirect your customers to that URL.


# Deposit Callback

Webhook after receving payment.

## Deposit Callback

In this step, we are sending you a webhook with the status of the payement to your provided URL in the FCF Pay dashboard as a project callback URL.&#x20;

This webhook happens when you receive payment.

The request has a JSON body value like this:

```
{
  "success": true,
  "data": {
    "order_id": "68",
    "user_id": "",
    "deposited": true,
    "txid": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849", 
    "unique_id": "0x9cf24f76778e517511f6178f114a1d3e95e3c7fdbfcbe52a961b6d748e860849_0",
    "fiat_amount": "26.12"
    "fiat_currency": "USD"
    "amount": "64464",
    "currency": "BTC",
    "confirm_blocks": 72,
    "fees": "662",
    "decimal": 8,
    "fee_decimal": 8
  },
  "message": "Payment Received"
}
```

| Field           | Description                                                                                                           |
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
| order\_id       | it's the same order Id which you sent us in create order                                                              |
| user\_id        | The user\_id is the same as you sent us in create-order                                                               |
| txid            | txid is the deposit transaction id                                                                                    |
| unique\_id      | The unique id is that order unique id which you should take and call to check-source endpoint for checking the source |
| deposited       | True/False: when it's true the transaction is successfully deposited, when it's false transaction is not deposited    |
| confirm\_blocks | Confiramation blocks count                                                                                            |
| fiat\_amount    | The fiat amount is converted by using CMC API                                                                         |
| fiat\_currency  | The fiat\_amount currency name is the same as you sent us in create-order                                             |
| amount          | Transaction amount                                                                                                    |
| currency        | The currency is transferred cryptocurrency name                                                                       |
| fees            | The fees is miners fees for transaction                                                                               |
| decimal         | The decimal depends on paid cryptocurrencies                                                                          |
| fee\_decimal    | The fee decimal depends on paid cryptocurrencies                                                                      |


# Check Source

Check the 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](/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 %}


# Check Order

Get order information

After creating the order you can make a "check-order" request to check if the order was paid or not. as a response, you will get the same data as in the "deposit-callback" webhook.

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

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

{% 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({
  "order_id": "58"
});

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

fetch("https://merchant.fcfpay.com/api/v1/check-order", 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-order',
  'headers': {
    'Authorization': 'Bearer YOUR_LIVE_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "order_id": "68"
  })

};
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-order',
  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 =>'{
	"order_id": "68"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer YOUR_LIVE_API_KEY',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

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

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

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

payload = json.dumps({
  "order_id": "58"
})
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 Order

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

#### Query Parameters

| Name                                        | Type   | Description                    |
| ------------------------------------------- | ------ | ------------------------------ |
| order\_id<mark style="color:red;">\*</mark> | string | The Order ID you want to check |

{% tabs %}
{% tab title="200: OK Call successfull, payment deposited" %}

```javascript
{
    "success": true,
    "data": {
        "deposited": true,
        "order_id": "152",
        "user_id": "",
        "txid": "0x0437fda31de9a4e998cc8a1c00e1c6c605327401ce7edeb6e86c752f0be76ac3",
        "unique_id": "0x0437fda31de9a4e998cc8a1c00e1c6c605327401ce7edeb6e86c752f0be76ac3_0",
        "confirm_blocks": 27,
        "fiat_amount": "10.00",
        "fiat_currency": "USD",
        "amount": "25580000000000000",
        "currency": "BSC",
        "fees": "210000000000000",
        "decimal": 18,
        "fee_decimal": 18
    },
    "message": "Successfully fetched."
}
```

{% endtab %}

{% tab title="200: OK Call successfull, payment not deposited" %}

```javascript
{
    "success": true,
    "data": {
        "deposited": false,
        "order_id": "68",
        "user_id": "",
        "txid": "",
        "unique_id": "",
        "confirm_blocks": "",
        "fiat_amount": "",
        "fiat_currency": "CAD",
        "amount": "",
        "currency": "",
        "fees": "",
        "decimal": "",
        "fee_decimal": ""
    },
    "message": "Successfully fetched."
}
```

{% endtab %}
{% endtabs %}


# Check Orders

Get order information

You can make a "check-orders" request to check the payment status of multiple orders.

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

```
curl --location -g --request POST '{{BASE_URL}}/check-orders' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "order_ids": ["1","2"]
}'
```

{% endtab %}

{% tab title="JavaScript" %}

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

var raw = JSON.stringify({
  "order_ids": [
    "1",
    "2"
  ]
});

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

fetch("{{BASE_URL}}/check-orders", 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': '{{BASE_URL}}/check-orders',
  'headers': {
    'Authorization': 'Bearer {{API_KEY}}',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "order_ids": [
      "1",
      "2"
    ]
  })

};
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 => '%7B%7BBASE_URL%7D%7D/check-orders',
  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 =>'{
    "order_ids": ["1","2"]
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer {{API_KEY}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "{{BASE_URL}}/check-orders"

payload = json.dumps({
  "order_ids": [
    "1",
    "2"
  ]
})
headers = {
  'Authorization': 'Bearer {{API_KEY}}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

## Check Order

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

#### Query Parameters

| Name                                         | Type  | Description                     |
| -------------------------------------------- | ----- | ------------------------------- |
| order\_ids<mark style="color:red;">\*</mark> | array | The Order IDs you want to check |

{% tabs %}
{% tab title="200: OK Call successfull, payment deposited" %}

```javascript
{
    "success": true,
    "data": {
        "1": {
            "deposited": false,
            "order_id": "1",
            "user_id": "1",
            "txid": "",
            "unique_id": "",
            "confirm_blocks": "",
            "status": "waiting",
            "fiat_amount": null,
            "fiat_currency": "USD",
            "amount": "",
            "currency": "",
            "fees": "",
            "decimal": "",
            "fee_decimal": ""
        },
        "162": {
            "deposited": true,
            "order_id": "162",
            "user_id": "",
            "txid": "0xfc896c0536f39bc7c0fe5e5c73231c3afa4805680427fca2fe24292f74f30a70",
            "unique_id": "0xfc896c0536f39bc7c0fe5e5c73231c3afa4805680427fca2fe24292f74f30a70_0",
            "confirm_blocks": 24,
            "status": "deposited",
            "fiat_amount": "10.77",
            "fiat_currency": "USD",
            "amount": "27548000000000000",
            "currency": "BSC",
            "fees": "210000000000000",
            "decimal": 18,
            "fee_decimal": 18
        }
    },
    "message": "Successfully fetched."
}
```

{% endtab %}
{% endtabs %}


