← На главную

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

Интегрируйте CoinVoice в ваш проект за несколько минут

Аутентификация

Все запросы к API требуют заголовок X-API-Key.

curl -H "X-API-Key: a7a5_your_api_key" \
  https://your-domain.com/api/v1/balance

API ключ доступен в личном кабинете — «API ключ»

POST /api/v1/invoices

Создать платёжный счёт

Параметры (JSON body)

ПолеТипОписание
amount*floatСумма в A7A5
descriptionstringОписание платежа
callback_urlstringURL для webhook уведомления
order_idstringID заказа в вашей системе
expiry_minutesintВремя жизни счёта (по умолч. 60)

Запрос

curl -X POST https://your-domain.com/api/v1/invoices \
  -H "X-API-Key: a7a5_your_key" \
  -H "Content-Type: application/json" \
  -d '{"amount": 100.00, "description": "Заказ #42", "order_id": "42"}'

Ответ

{
  "invoice_id": "abc123def456",
  "amount": 100.00,
  "currency": "A7A5",
  "address": "TXzTQ...",
  "status": "pending",
  "payment_url": "/pay/abc123def456",
  "expires_at": "2026-03-26T10:00:00+00:00"
}

GET /api/v1/invoices/{invoice_id}

Получить статус счёта

curl https://your-domain.com/api/v1/invoices/abc123def456 \
  -H "X-API-Key: a7a5_your_key"

GET /api/v1/invoices

Список счетов. Параметры: ?status=paid&limit=50&offset=0

GET /api/v1/balance

Текущий баланс

{"balance": 950.00, "total_received": 1000.00, "withdrawn": 50.00}

Webhook

При подтверждении оплаты мы отправим POST на ваш webhook_url:

{
  "event": "payment.confirmed",
  "invoice_uid": "abc123def456",
  "amount": 100.00,
  "tx_hash": "abc...def",
  "status": "paid",
  "timestamp": "2026-03-26T09:30:00+00:00"
}

SDK Примеры

Python

import requests

API_KEY = "a7a5_your_key"
BASE_URL = "https://your-domain.com"

def create_invoice(amount, description=""):
    resp = requests.post(f"{BASE_URL}/api/v1/invoices",
        headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
        json={"amount": amount, "description": description})
    return resp.json()

def check_invoice(invoice_id):
    resp = requests.get(f"{BASE_URL}/api/v1/invoices/{invoice_id}",
        headers={"X-API-Key": API_KEY})
    return resp.json()

# Create a 100 A7A5 invoice
inv = create_invoice(100.0, "Premium план")
print(f"Payment URL: {BASE_URL}{inv['payment_url']}")

JavaScript (Node.js)

const API_KEY = 'a7a5_your_key';
const BASE_URL = 'https://your-domain.com';

async function createInvoice(amount, description = '') {
  const resp = await fetch(`${BASE_URL}/api/v1/invoices`, {
    method: 'POST',
    headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ amount, description })
  });
  return resp.json();
}

async function checkInvoice(invoiceId) {
  const resp = await fetch(`${BASE_URL}/api/v1/invoices/${invoiceId}`, {
    headers: { 'X-API-Key': API_KEY }
  });
  return resp.json();
}

// Usage
const inv = await createInvoice(100.0, 'Premium план');
console.log(`Payment URL: ${BASE_URL}${inv.payment_url}`);