MENU navbar-image

Введение

Документация API GetCrypto

Целью этой документации является предоставление всей информации, необходимой вам для работы с нашим API.

Аутентификация запросов

Для аутентификации запросов, добавьте Authorization заголовок со значением "Bearer {YOUR_AUTH_KEY}".

Все эндпоинты для которых требуется аутентификация отменчены плашкой requires authentication в документации.

Вы можете сгенерировать API ключ в личном кабинете.

Запросы к API

Создать новый счет

requires authentication

Пример запроса:
curl --request POST \
    "https://api.getcrypto.finance/v1/invoices" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"language\": \"en\",
    \"input_amount\": 9,
    \"currency\": \"rub\",
    \"cryptocurrency\": \"btc\",
    \"project_id\": \"pr_64e5a94d9c3f4\",
    \"order_id\": \"ORD_123\",
    \"network\": \"bep20\",
    \"custom_fields\": \"{\\\"custom_field_1\\\": \\\"value_1\\\", \\\"custom_field_2\\\": \\\"value_2\\\"}\"
}"
$client = new \GuzzleHttp\Client();
$response = $client->post(
    'https://api.getcrypto.finance/v1/invoices',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'language' => 'en',
            'input_amount' => 9,
            'currency' => 'rub',
            'cryptocurrency' => 'btc',
            'project_id' => 'pr_64e5a94d9c3f4',
            'order_id' => 'ORD_123',
            'network' => 'bep20',
            'custom_fields' => '{"custom_field_1": "value_1", "custom_field_2": "value_2"}',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://api.getcrypto.finance/v1/invoices"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "language": "en",
    "input_amount": 9,
    "currency": "rub",
    "cryptocurrency": "btc",
    "project_id": "pr_64e5a94d9c3f4",
    "order_id": "ORD_123",
    "network": "bep20",
    "custom_fields": "{\"custom_field_1\": \"value_1\", \"custom_field_2\": \"value_2\"}"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
import requests
import json

url = 'https://api.getcrypto.finance/v1/invoices'
payload = {
    "language": "en",
    "input_amount": 9,
    "currency": "rub",
    "cryptocurrency": "btc",
    "project_id": "pr_64e5a94d9c3f4",
    "order_id": "ORD_123",
    "network": "bep20",
    "custom_fields": "{\"custom_field_1\": \"value_1\", \"custom_field_2\": \"value_2\"}"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Запрос      

POST v1/invoices

Заголовок

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Параметры тела запроса

language   string   

Example: en

Must be one of:
  • en
  • ru
input_amount   number   

validation.min validation.max. Example: 9

currency   string   

Example: rub

Must be one of:
  • usd
  • eur
  • rub
  • usdt
  • usdc
  • btc
  • eth
cryptocurrency   string   

Example: btc

Must be one of:
  • usdt
  • usdc
  • btc
  • eth
project_id   string   

Must start with one of pr_ validation.size. Example: pr_64e5a94d9c3f4

order_id   string   

Internal Order ID. validation.min validation.max. Example: ORD_123

network   string   

USDT/USDC: bep20, trc20, erc20, BTC: btc, ETH: eth. Example: bep20

custom_fields   string  optional  

Any additional information in json format. validation.json. Example: {"custom_field_1": "value_1", "custom_field_2": "value_2"}

Проверить статус счета

requires authentication

Пример запроса:
curl --request GET \
    --get "https://api.getcrypto.finance/v1/invoices/in_64e5a94d9c3f4" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://api.getcrypto.finance/v1/invoices/in_64e5a94d9c3f4',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://api.getcrypto.finance/v1/invoices/in_64e5a94d9c3f4"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
import requests
import json

url = 'https://api.getcrypto.finance/v1/invoices/in_64e5a94d9c3f4'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Пример ответа (400):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
vary: Origin
 

{
    "status": false,
    "message": "Invoice does not exist or does not belong to this key"
}
 

Запрос      

GET v1/invoices/{invoice_id}

Заголовок

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Параметры URL

invoice_id   string   

The ID of the invoice. Example: in_64e5a94d9c3f4

Инициализация виджета

requires authentication

Пример запроса:
curl --request GET \
    --get "https://api.getcrypto.finance/v1/widget?project_id=pr_64e5a94d9c3f4&currency=eur&language=en&amount=11&order_id=ORD_123" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
$client = new \GuzzleHttp\Client();
$response = $client->get(
    'https://api.getcrypto.finance/v1/widget',
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'project_id' => 'pr_64e5a94d9c3f4',
            'currency' => 'eur',
            'language' => 'en',
            'amount' => '11',
            'order_id' => 'ORD_123',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://api.getcrypto.finance/v1/widget"
);

const params = {
    "project_id": "pr_64e5a94d9c3f4",
    "currency": "eur",
    "language": "en",
    "amount": "11",
    "order_id": "ORD_123",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
import requests
import json

url = 'https://api.getcrypto.finance/v1/widget'
params = {
  'project_id': 'pr_64e5a94d9c3f4',
  'currency': 'eur',
  'language': 'en',
  'amount': '11',
  'order_id': 'ORD_123',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Пример ответа (200):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
vary: Origin
 

{
    "data": {
        "project_name": "Test",
        "success_url": "https://api.getcrypto.finance/success",
        "fail_url": "https://api.getcrypto.finance/fail",
        "methods": {
            "usdt": {
                "id": 1,
                "label": "USDT",
                "networks": {
                    "bep20": {
                        "id": 1,
                        "label": "BEP20"
                    },
                    "trc20": {
                        "id": 2,
                        "label": "TRC20"
                    },
                    "erc20": {
                        "id": 3,
                        "label": "ERC20"
                    }
                }
            },
            "usdc": {
                "id": 2,
                "label": "USDC",
                "networks": {
                    "bep20": {
                        "id": 4,
                        "label": "BEP20"
                    },
                    "trc20": {
                        "id": 5,
                        "label": "TRC20"
                    },
                    "erc20": {
                        "id": 6,
                        "label": "ERC20"
                    }
                }
            },
            "btc": {
                "id": 3,
                "label": "BTC",
                "networks": {
                    "btc": {
                        "id": 7,
                        "label": "BTC"
                    }
                }
            },
            "eth": {
                "id": 4,
                "label": "ETH",
                "networks": {
                    "eth": {
                        "id": 8,
                        "label": "ETH"
                    }
                }
            }
        },
        "amounts": {
            "usdt": 11.944214,
            "usdc": 11.941625,
            "btc": 0.000451,
            "eth": 0.007131
        }
    },
    "status": true
}
 

Запрос      

GET v1/widget

Заголовок

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

Параметры запроса

project_id   string   

Must start with one of pr_ validation.size. Example: pr_64e5a94d9c3f4

currency   string   

Example: eur

Must be one of:
  • usd
  • eur
  • rub
  • usdt
  • usdc
  • btc
  • eth
language   string   

Example: en

Must be one of:
  • en
  • ru
amount   number   

validation.min validation.max. Example: 11

order_id   string   

Internal Order ID. validation.min validation.max. Example: ORD_123

Уведомление о платеже

POST-запрос с информацией о платеже в формате json будет отправлен после успешного подтверждения на URL-адрес ответа указанный в настройках проекта.

Если код ответа не будет равен 200, сервис сделает до 10 попыток отправить запрос с постепенным увеличением временного интервала.

Пример ответа:

Платежный виджет

Для установки виджета необходимо прописать на сайте скрипт в раздел head:

Для появления платежной формы необходимо вызвать функцию, передав в нее полученный в личном кабинет ключ API, идентификатор html элемента и другие обязательные параметры.