API-Dokumentation — v1.0
Alle API-Anfragen erfordern HMAC-SHA256-Authentifizierung über HTTP-Header. Erhalten Sie Ihre Zugangsdaten im Händler-Dashboard → Shops.
| Header | Beschreibung |
|---|---|
| X-Api-Key | Ihr Shop-API-Schlüssel |
| X-Timestamp | Aktueller Unix-Zeitstempel (±5 Min. Fenster) |
| X-Signature | HMAC-SHA256 von timestamp + method + path + body mit API Secret signiert |
payload = "1700000000" + "POST" + "/api/v1/payment/create" + '{"amount":"100"}'
signature = HMAC-SHA256(payload, api_secret)
Neue Zahlung erstellen. Unterstützt direkte Krypto-Beträge und Fiat→Krypto-Umrechnung.
| Parameter | Typ | Beschreibung |
|---|---|---|
| amount* | string | Krypto-Betrag (z.B. "100.00" USDT oder "0.005" BTC) |
| order_id | string | Ihre interne Bestell-ID |
| fiat_amount | string | Fiat-Betrag (überschreibt amount) |
| fiat_currency | string | Fiat-Währung: USD, EUR, RUB, CNY, GBP |
| metadata | object | Beliebiges JSON (wird im Webhook zurückgegeben) |
payment_url mit Währungsauswahl zurück. Ist nur eine aktiviert, wird die Zahlung sofort erstellt.fiat_amount + fiat_currency für automatische Fiat-Umrechnung.{
"success": true,
"data": {
"payment_id": "a1b2c3d4-...",
"amount": "100.14",
"currency": "USDT_TRC20",
"pay_address": "TXyz...abc",
"status": "pending",
"expires_at": "2025-01-15T12:30:00Z",
"payment_url": "https://soko.ai/pay/a1b2c3d4-..."
}
}
{
"success": true,
"data": {
"payment_id": null,
"status": "selecting",
"amount": 100,
"currencies": ["USDT_TRC20", "BTC", "ETH"],
"payment_url": "https://soko.ai/pay/select?token=..."
}
}
payment_url weiter. Wenn payment_id = null, wählt der Benutzer zuerst eine Währung.{
"success": true,
"data": {
"payment_id": "a1b2c3d4-...",
"order_id": "ORDER-123",
"status": "completed",
"amount_requested": 100.14,
"amount_with_cents": 100.14,
"amount_received": 100.14,
"currency": "USDT_TRC20",
"pay_address": "TXyz...abc",
"tx_hash": "abc123...",
"confirmations": 21,
"confirmed_at": "2025-01-15T12:25:00Z",
"expires_at": "2025-01-15T12:30:00Z",
"created_at": "2025-01-15T12:00:00Z"
}
}
| Status | Beschreibung |
|---|---|
| selecting | Kunde wählt Währung |
| pending | Warten auf Zahlung |
| queued | Alle USDT-Slots belegt |
| confirming | Transaktion erkannt, warte auf Bestätigungen |
| completed | Zahlung bestätigt |
| expired | Keine Zahlung vor Ablauf |
| overpaid | Mehr als erwartet erhalten |
| underpaid | Weniger als erwartet erhalten |
Paginierte Zahlungsliste.
| Parameter | Typ | Beschreibung |
|---|---|---|
| pageoptional | integer | Seitennummer (Standard: 1) |
| per_pageoptional | integer | Ergebnisse pro Seite, 1-100 (Standard: 20) |
| statusoptional | string | Nach Status filtern |
| currencyoptional | string | Nach Währung filtern |
{
"success": true,
"data": {
"USDT_TRC20": {
"available": 1250.50,
"pending": 100.00,
"total_received": 5000.00,
"total_withdrawn": 3750.00,
"total_commission": 75.00
},
"BTC": {
"available": 0.05000000,
"pending": 0.00100000,
"total_received": 0.10000000,
"total_withdrawn": 0.04900000,
"total_commission": 0.00150000
},
"ETH": {
"available": 1.25000000,
"pending": 0.10000000,
"total_received": 2.00000000,
"total_withdrawn": 0.65000000,
"total_commission": 0.03000000
}
}
}
Keine Authentifizierung erforderlich. 5 Min. Cache.
GET /api/v1/rates?amount=5000&fiat=RUB&crypto=USDT_TRC20
{
"success": true,
"data": {
"rates": {
"btc": { "usd": 97500, "eur": 91200, "rub": 8775000 },
"eth": { "usd": 3200, "eur": 2990, "rub": 288000 },
"usdt": { "usd": 1.0001, "eur": 0.935, "rub": 90.5 }
},
"converted": 55.24
}
}
Bei Statusänderung senden wir einen POST-Request an Ihre Webhook-URL.
| Header | Beschreibung |
|---|---|
| X-Signature | HMAC-SHA256 von timestamp + body mit Webhook Secret signiert |
| X-Timestamp | Unix-Zeitstempel |
{
"event": "payment.completed",
"payment_id": "a1b2c3d4-...",
"order_id": "ORDER-123",
"amount": 100.14,
"amount_received": 100.14,
"currency": "USDT_TRC20",
"tx_hash": "abc123...",
"confirmed_at": "2025-01-15T12:25:00Z",
"status": "completed",
"metadata": { "user_id": 42 }
}
| payment.completed | Zahlung bestätigt |
| payment.confirming | Transaktion erkannt |
| payment.expired | Zahlung abgelaufen |
| payment.underpaid | Weniger erhalten |
$timestamp = $_SERVER['HTTP_X_TIMESTAMP'];
$signature = $_SERVER['HTTP_X_SIGNATURE'];
$body = file_get_contents('php://input');
$expected = hash_hmac('sha256', $timestamp . $body, $webhookSecret);
if (!hash_equals($expected, $signature)) {
http_response_code(401);
die('Invalid signature');
}
$payload = json_decode($body, true);
// Process payment...
Zahlungs-Widget einbetten. Nur HTML + JS nötig.
<script src="https://soko.ai/widget.js"></script>
<script>
CryptoMerchant.init({ apiKey: 'YOUR_STORE_API_KEY' });
document.getElementById('pay-btn').addEventListener('click', function() {
CryptoMerchant.pay({
amount: 100.00,
order_id: 'ORDER-123',
// Or use fiat conversion:
// fiat_amount: 5000,
// fiat_currency: 'RUB',
onSuccess: function(payment) {
alert('Payment confirmed! TX: ' + payment.tx_hash);
},
onClose: function() {
console.log('Widget closed');
},
onError: function(err) {
console.error('Payment error:', err);
}
});
});
</script>
<button id="pay-btn">Pay with Crypto</button>
Akzeptieren Sie Kryptospenden auf jeder Website. Keine API-Signatur erforderlich — nur Ihr Store-API-Key.
Aktivieren Sie Spenden in Ihren Store-Einstellungen und fügen Sie das Widget zu Ihrer Website hinzu. Besucher können in USDT, BTC oder ETH spenden. Jede Spende erstellt eine nachverfolgte Zahlung — sichtbar im Dashboard unter ❤️ Spenden.
Fügt einen "Spenden"-Button an der Skriptposition ein:
<script src="https://soko.ai/donate-widget.js"
data-store-key="YOUR_STORE_API_KEY"></script>
Zeigt eine fixierte Spendenleiste oben auf der Seite:
<script src="https://soko.ai/donate-widget.js"
data-store-key="YOUR_STORE_API_KEY"
data-mode="topbar"></script>
Rendert den Button innerhalb eines bestimmten Elements:
<div id="crypto-donate"></div>
<script src="https://soko.ai/donate-widget.js"
data-store-key="YOUR_STORE_API_KEY"
data-mode="inline"
data-target="crypto-donate"></script>
| Parameter | Beschreibung |
|---|---|
| data-store-key | Store-API-Key required |
| data-mode | button (Standard), topbar oder inline |
| data-target | Element-ID für Inline-Modus optional |
| data-text | Benutzerdefinierter Text (überschreibt Store-Einstellungen) optional |
| data-amounts | Voreingestellte Beträge, kommagetrennt: "5,10,25" optional |
| data-color | Akzentfarbe, z.B. "#e11d48" optional |
Sie können auch direkt auf die Spendenseite verlinken, ohne Widget:
https://soko.ai/donate/YOUR_STORE_API_KEY
Spende programmatisch erstellen. Keine Signatur erforderlich.
| Parameter | Beschreibung |
|---|---|
| api_key | Store-API-Key required |
| fiat_amount | Betrag in Fiat (z.B. 10) required* |
| fiat_currency | Fiat-Währungscode (z.B. USD) optional, default: USD |
| amount | Direkter Kryptobetrag (Alternative zu Fiat) optional |
| currency | USDT_TRC20, BTC oder ETH required |
| donor_name | Name des Spenders optional |
| donor_message | Nachricht des Spenders (max. 500 Zeichen) optional |
{
"success": false,
"error": "Description of what went wrong"
}
| HTTP-Code | Bedeutung |
|---|---|
| 200 | Erfolg |
| 400 | Ungültige Anfrage |
| 401 | Fehlende Auth-Header |
| 403 | Ungültige Signatur |
| 404 | Nicht gefunden |
| 500 | Serverfehler |
<?php
$apiKey = 'your_api_key';
$apiSecret = 'your_api_secret';
$body = json_encode([
'amount' => '100.00',
'order_id' => 'ORDER-' . time(),
]);
$timestamp = (string) time();
$method = 'POST';
$path = '/api/v1/payment/create';
$signature = hash_hmac('sha256', $timestamp . $method . $path . $body, $apiSecret);
$ch = curl_init('https://soko.ai' . $path);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Api-Key: ' . $apiKey,
'X-Timestamp: ' . $timestamp,
'X-Signature: ' . $signature,
],
]);
$response = json_decode(curl_exec($ch), true);
echo $response['data']['payment_url'];
import hmac, hashlib, time, json, requests
API_KEY = 'your_api_key'
API_SECRET = 'your_api_secret'
BASE_URL = 'https://soko.ai'
body = json.dumps({
'amount': '100.00',
'order_id': f'ORDER-{int(time.time())}'
})
timestamp = str(int(time.time()))
method = 'POST'
path = '/api/v1/payment/create'
payload = f'{timestamp}{method}{path}{body}'
signature = hmac.new(API_SECRET.encode(), payload.encode(), hashlib.sha256).hexdigest()
r = requests.post(f'{BASE_URL}{path}', data=body, headers={
'Content-Type': 'application/json',
'X-Api-Key': API_KEY,
'X-Timestamp': timestamp,
'X-Signature': signature,
})
print(r.json()['data']['payment_url'])
const crypto = require('crypto');
const https = require('https');
const API_KEY = 'your_api_key';
const API_SECRET = 'your_api_secret';
const body = JSON.stringify({
amount: '100.00',
order_id: `ORDER-${Date.now()}`
});
const timestamp = Math.floor(Date.now() / 1000).toString();
const method = 'POST';
const path = '/api/v1/payment/create';
const signature = crypto
.createHmac('sha256', API_SECRET)
.update(timestamp + method + path + body)
.digest('hex');
fetch('https://soko.ai' + path, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': API_KEY,
'X-Timestamp': timestamp,
'X-Signature': signature,
},
body
})
.then(r => r.json())
.then(data => console.log(data.data.payment_url));
# Generate signature first (bash):
TIMESTAMP=$(date +%s)
BODY='{"amount":"100.00","order_id":"ORDER-1"}'
PAYLOAD="${TIMESTAMP}POST/api/v1/payment/create${BODY}"
SIGNATURE=$(echo -n "$PAYLOAD" | openssl dgst -sha256 -hmac "your_api_secret" | cut -d' ' -f2)
curl -X POST https://soko.ai/api/v1/payment/create \
-H "Content-Type: application/json" \
-H "X-Api-Key: your_api_key" \
-H "X-Timestamp: $TIMESTAMP" \
-H "X-Signature: $SIGNATURE" \
-d "$BODY"