Documentation Index Fetch the complete documentation index at: https://docs.loveandpay.io/llms.txt
Use this file to discover all available pages before exploring further.
Обзор
LoveCrypto — криптовалютный платёжный шлюз для приёма USDT и USDC на сетях TRC20, ERC20 и BEP20.
Быстрая интеграция Простой REST API для создания счетов и вывода средств
Мультисеть Поддержка Tron, Ethereum и BNB Smart Chain
Автоматические уведомления Вебхуки о платежах в реальном времени
Низкие комиссии Комиссия 1% на приём и вывод средств
Поддерживаемые валюты
Валюта Сеть Код Tether USD Tron (TRC20) USDT_TRC20Tether USD Ethereum (ERC20) USDT_ERC20Tether USD BSC (BEP20) USDT_BEP20USD Coin Ethereum (ERC20) USDC_ERC20USD Coin BSC (BEP20) USDC_BEP20
Быстрый старт
Зарегистрируйте мерчанта
curl -X POST "https://crypto.api.loveandpay.io/api/v1/merchants/register" \
-H "Content-Type: application/json" \
-d '{
"companyName": "My Company LLC",
"email": "merchant@example.com",
"address": "123 Main Street"
}'
В ответе вы получите apiKey и hmacSecret — сохраните их!
Создайте счёт
curl -X POST "https://crypto.api.loveandpay.io/api/v1/invoices" \
-H "Content-Type: application/json" \
-H "X-Api-Key: lc_ваш_ключ" \
-H "X-Timestamp: 1706400000" \
-H "X-Signature: ваша_подпись" \
-d '{
"amount": 100.50,
"currency": "USDT_TRC20",
"externalId": "order-12345"
}'
Получите платёж
Клиент отправляет криптовалюту на адрес paymentAddress из ответа
Обработайте вебхук
При оплате вы получите вебхук InvoicePaid на ваш URL
Аутентификация
API ключ
Все защищённые эндпоинты требуют заголовок X-Api-Key:
X-Api-Key: lc_H8BLURMH0Vq241DqzatqOHajKUlBQERF
HMAC подпись
Для операций создания счетов и выводов требуется HMAC-SHA256 подпись.
Формат payload:
{timestamp}.{HTTP_METHOD}.{path}{body}
Пример:
1706400000.POST./api/v1/invoices{"amount":100.50,"currency":"USDT_TRC20"}
Заголовки:
X-Timestamp — Unix timestamp в секундах
X-Signature — Base64 HMAC-SHA256 подпись
Запрос должен быть выполнен в течение 5 минут от указанного timestamp.
Примеры генерации подписи
import hmac
import hashlib
import base64
import time
def get_hmac_signature ( secret : str , method : str , path : str , body : str = "" ) -> tuple :
timestamp = int (time.time())
payload = f " { timestamp } . { method } . { path }{ body } "
signature = hmac.new(
secret.encode( 'utf-8' ),
payload.encode( 'utf-8' ),
hashlib.sha256
).digest()
return timestamp, base64.b64encode(signature).decode( 'utf-8' )
const crypto = require ( 'crypto' );
function getHmacSignature ( secret , method , path , body = '' ) {
const timestamp = Math . floor ( Date . now () / 1000 );
const payload = ` ${ timestamp } . ${ method } . ${ path }${ body } ` ;
const signature = crypto
. createHmac ( 'sha256' , secret )
. update ( payload )
. digest ( 'base64' );
return { timestamp , signature };
}
function getHmacSignature ( $secret , $method , $path , $body = '' ) {
$timestamp = time ();
$payload = "{ $timestamp }.{ $method }.{ $path }{ $body }" ;
$signature = base64_encode ( hash_hmac ( 'sha256' , $payload , $secret , true ));
return [ 'timestamp' => $timestamp , 'signature' => $signature ];
}
using System . Security . Cryptography ;
using System . Text ;
public static ( long timestamp , string signature ) GetHmacSignature (
string secret , string method , string path , string body = "" )
{
var timestamp = DateTimeOffset . UtcNow . ToUnixTimeSeconds ();
var payload = $" { timestamp } . { method } . { path }{ body } " ;
using var hmac = new HMACSHA256 ( Encoding . UTF8 . GetBytes ( secret ));
var hash = hmac . ComputeHash ( Encoding . UTF8 . GetBytes ( payload ));
return ( timestamp , Convert . ToBase64String ( hash ));
}
Создание счёта
curl -X POST "https://crypto.api.loveandpay.io/api/v1/invoices" \
-H "Content-Type: application/json" \
-H "X-Api-Key: lc_ваш_ключ" \
-H "X-Timestamp: 1706400000" \
-H "X-Signature: ваша_подпись" \
-d '{
"amount": 100.50,
"currency": "USDT_TRC20",
"externalId": "order-12345",
"description": "Оплата заказа #12345",
"customerEmail": "customer@example.com",
"successUrl": "https://mysite.com/success",
"expirationMinutes": 30
}'
Ответ:
{
"success" : true ,
"data" : {
"id" : "f47ac10b-58cc-4372-a567-0e02b2c3d479" ,
"invoiceNumber" : "INV-20260121-ABC123" ,
"amount" : 100.50 ,
"currency" : "USDT_TRC20" ,
"paymentAddress" : "TDPWsYuCP8H5Q93Sk3yR3x5yEvPXSVjxJZ" ,
"status" : "Pending" ,
"expiresAt" : "2026-01-21T20:30:00Z"
}
}
Адрес paymentAddress уникален для каждого счёта. Отобразите его клиенту вместе с QR-кодом.
Статусы счёта
Статус Описание PendingОжидает оплаты PartiallyPaidПолучена частичная оплата PaidПолностью оплачен OverpaidПолучено больше требуемой суммы ExpiredИстёк срок оплаты CancelledОтменён
Вебхуки
Настройте webhookUrl при регистрации мерчанта для получения уведомлений.
События
InvoicePaid
TransactionDetected
TransactionConfirmed
InvoiceExpired
Счёт полностью оплачен: {
"eventType" : "InvoicePaid" ,
"invoice" : {
"id" : "f47ac10b-58cc-4372-a567-0e02b2c3d479" ,
"invoiceNumber" : "INV-20260121-ABC123" ,
"amount" : 100.50 ,
"amountPaid" : 100.50 ,
"status" : "Paid" ,
"paidAt" : "2026-01-21T20:15:00Z"
},
"transactions" : [
{
"txHash" : "ce1a930bc5bbfcd..." ,
"amount" : 100.50
}
]
}
Обнаружена транзакция (ещё не подтверждена): {
"eventType" : "TransactionDetected" ,
"transaction" : {
"txHash" : "ce1a930bc5bbfcd..." ,
"amount" : 100.50 ,
"confirmations" : 1 ,
"status" : "Pending"
},
"invoice" : {
"id" : "f47ac10b-58cc-4372-a567-0e02b2c3d479" ,
"status" : "PartiallyPaid"
}
}
Транзакция подтверждена: {
"eventType" : "TransactionConfirmed" ,
"transaction" : {
"txHash" : "ce1a930bc5bbfcd..." ,
"amount" : 100.50 ,
"confirmations" : 25 ,
"status" : "Confirmed"
}
}
Счёт истёк: {
"eventType" : "InvoiceExpired" ,
"invoice" : {
"id" : "f47ac10b-58cc-4372-a567-0e02b2c3d479" ,
"status" : "Expired"
}
}
Верификация подписи вебхука
Вебхуки подписываются вашим HMAC секретом. Проверяйте заголовок X-Webhook-Signature:
import hmac
import hashlib
def verify_webhook ( payload : bytes , signature : str , secret : str ) -> bool :
expected = hmac.new(
secret.encode(),
payload,
hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, signature)
Политика повторных попыток
Попытка Интервал 1 1 минута 2 5 минут 3 30 минут 4 2 часа 5 24 часа
Вывод средств
Получение баланса
curl -X GET "https://crypto.api.loveandpay.io/api/v1/withdrawals/balance" \
-H "X-Api-Key: lc_ваш_ключ"
Ответ:
{
"success" : true ,
"data" : {
"balances" : [
{
"currency" : "USDT_TRC20" ,
"network" : "Tron" ,
"available" : 1500.50 ,
"pending" : 100.00 ,
"total" : 1600.50
}
],
"totalUsdValue" : 1600.50
}
}
Создание вывода
curl -X POST "https://crypto.api.loveandpay.io/api/v1/withdrawals" \
-H "Content-Type: application/json" \
-H "X-Api-Key: lc_ваш_ключ" \
-H "X-Timestamp: 1706400000" \
-H "X-Signature: ваша_подпись" \
-d '{
"toAddress": "TQaqeXyS14drW5CB7HRo87yLPZjNvbGs1q",
"amount": 100.00,
"currency": "USDT_TRC20"
}'
Комиссия за вывод: 1% . При выводе 100 USDT вы получите 99 USDT.
Требования сетей
Сеть Подтверждения Время блока Газ Tron 20 ~3 сек 25-30 TRX Ethereum 12 ~12 сек 0.005-0.02 ETH BSC 15 ~3 сек 0.001-0.005 BNB
Лимиты
Параметр Значение Запросов в минуту 100 Создание счетов в минуту 30 Выводы в минуту 10
SDK примеры
import requests
import json
import hmac
import hashlib
import base64
import time
class LoveCryptoClient :
def __init__ ( self , api_key : str , hmac_secret : str ):
self .api_key = api_key
self .hmac_secret = hmac_secret
self .base_url = 'https://crypto.api.loveandpay.io'
def _get_signature ( self , method : str , path : str , body : str = '' ) -> tuple :
timestamp = int (time.time())
payload = f ' { timestamp } . { method } . { path }{ body } '
signature = base64.b64encode(
hmac.new( self .hmac_secret.encode(), payload.encode(), hashlib.sha256).digest()
).decode()
return timestamp, signature
def _request ( self , method : str , path : str , body : dict = None , hmac_required : bool = False ):
headers = { 'X-Api-Key' : self .api_key, 'Content-Type' : 'application/json' }
body_json = json.dumps(body, separators = ( ',' , ':' )) if body else ''
if hmac_required:
timestamp, signature = self ._get_signature(method, path, body_json)
headers[ 'X-Timestamp' ] = str (timestamp)
headers[ 'X-Signature' ] = signature
response = requests.request(
method,
f ' { self .base_url }{ path } ' ,
headers = headers,
data = body_json if body else None
)
return response.json()
def create_invoice ( self , amount : float , currency : str , external_id : str = None ):
body = { 'amount' : amount, 'currency' : currency}
if external_id:
body[ 'externalId' ] = external_id
return self ._request( 'POST' , '/api/v1/invoices' , body, hmac_required = True )
def get_balance ( self ):
return self ._request( 'GET' , '/api/v1/withdrawals/balance' )
def create_withdrawal ( self , to_address : str , amount : float , currency : str ):
body = { 'toAddress' : to_address, 'amount' : amount, 'currency' : currency}
return self ._request( 'POST' , '/api/v1/withdrawals' , body, hmac_required = True )
# Использование
client = LoveCryptoClient( 'lc_ваш_ключ' , 'ваш_hmac_secret' )
# Создание счёта
invoice = client.create_invoice( 100.50 , 'USDT_TRC20' , 'order-123' )
print ( f "Адрес для оплаты: { invoice[ 'data' ][ 'paymentAddress' ] } " )
# Баланс
balance = client.get_balance()
print (balance)
const crypto = require ( 'crypto' );
const axios = require ( 'axios' );
class LoveCryptoClient {
constructor ( apiKey , hmacSecret ) {
this . apiKey = apiKey ;
this . hmacSecret = hmacSecret ;
this . baseUrl = 'https://crypto.api.loveandpay.io' ;
}
_getSignature ( method , path , body = '' ) {
const timestamp = Math . floor ( Date . now () / 1000 );
const payload = ` ${ timestamp } . ${ method } . ${ path }${ body } ` ;
const signature = crypto
. createHmac ( 'sha256' , this . hmacSecret )
. update ( payload )
. digest ( 'base64' );
return { timestamp , signature };
}
async _request ( method , path , body = null , hmacRequired = false ) {
const headers = {
'X-Api-Key' : this . apiKey ,
'Content-Type' : 'application/json'
};
const bodyJson = body ? JSON . stringify ( body ) : '' ;
if ( hmacRequired ) {
const { timestamp , signature } = this . _getSignature ( method , path , bodyJson );
headers [ 'X-Timestamp' ] = timestamp . toString ();
headers [ 'X-Signature' ] = signature ;
}
const response = await axios ({
method ,
url: ` ${ this . baseUrl }${ path } ` ,
headers ,
data: body
});
return response . data ;
}
async createInvoice ( amount , currency , externalId = null ) {
const body = { amount , currency };
if ( externalId ) body . externalId = externalId ;
return this . _request ( 'POST' , '/api/v1/invoices' , body , true );
}
async getBalance () {
return this . _request ( 'GET' , '/api/v1/withdrawals/balance' );
}
async createWithdrawal ( toAddress , amount , currency ) {
return this . _request ( 'POST' , '/api/v1/withdrawals' ,
{ toAddress , amount , currency }, true );
}
}
// Использование
const client = new LoveCryptoClient ( 'lc_ваш_ключ' , 'ваш_hmac_secret' );
( async () => {
const invoice = await client . createInvoice ( 100.50 , 'USDT_TRC20' , 'order-123' );
console . log ( 'Адрес для оплаты:' , invoice . data . paymentAddress );
})();
Коды ошибок
Код Описание INVALID_API_KEYНеверный или отозванный API ключ SIGNATURE_REQUIREDТребуется HMAC подпись INVALID_SIGNATUREНеверная HMAC подпись TIMESTAMP_EXPIREDTimestamp устарел (>5 минут) INSUFFICIENT_BALANCEНедостаточно средств для вывода INVOICE_NOT_FOUNDСчёт не найден VALIDATION_ERRORОшибка валидации запроса
API справочник
Счета (Invoices) Создание и управление счетами
Выводы (Withdrawals) Вывод средств на внешние кошельки
Транзакции Просмотр транзакций
Вебхуки Настройка через дашборд
Поддержка