curl -X POST https://chellhub.web.id/api/v1/dispatch \
-H "Content-Type: application/json" \
-H "X-API-Key: csk_live_YOUR_KEY_HERE" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"plan": "Premium",
"qty": 1,
"external_invoice_id": "INV-BOT-1049",
"warranty_days": 30
}'
import crypto from 'node:crypto';
async function dispatchNetflixAccount(invoiceId) {
const response = await fetch('https://chellhub.web.id/api/v1/dispatch', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.CHELL_API_KEY,
'Idempotency-Key': crypto.randomUUID()
},
body: JSON.stringify({
plan: 'Premium',
qty: 1,
external_invoice_id: invoiceId,
warranty_days: 30
})
});
if (!response.ok) {
throw new Error(`API Error: ${response.status} ${response.statusText}`);
}
const data = await response.json();
console.log('Stok berhasil diambil:', data.account.email);
return data;
}
import uuid
import requests
def dispatch_account(api_key: str, invoice_id: str):
url = "https://chellhub.web.id/api/v1/dispatch"
headers = {
"Content-Type": "application/json",
"X-API-Key": api_key,
"Idempotency-Key": str(uuid.uuid4())
}
payload = {
"plan": "Premium",
"qty": 1,
"external_invoice_id": invoice_id,
"warranty_days": 30
}
res = requests.post(url, json=payload, headers=headers, timeout=10)
res.raise_for_status()
return res.json()
<?php
$apiKey = getenv('CHELL_API_KEY');
$invoiceId = 'INV-BOT-' . rand(1000, 9999);
$ch = curl_init('https://chellhub.web.id/api/v1/dispatch');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-API-Key: ' . $apiKey,
'Idempotency-Key: ' . bin2hex(random_bytes(16))
],
CURLOPT_POSTFIELDS => json_encode([
'plan' => 'Premium',
'qty' => 1,
'external_invoice_id' => $invoiceId,
'warranty_days' => 30
]),
CURLOPT_TIMEOUT => 10
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$result = json_decode($response, true);
print_r($result);