cURL
PHP 8.3
Python
Node.js
کپی کد
curl -X POST https://0panel.com/api/v1/orders \
-H "Authorization: Bearer zp_live_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ord_9a8f4c12e7" \
-d '{
"ecosystem": "virtual-number",
"sku": "VN-TG-DE",
"webhook_url": "https://yourbot.ir/hooks/zp"
}'
$ch = curl_init('https://0panel.com/api/v1/orders');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer zp_live_YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(8)),
],
CURLOPT_POSTFIELDS => json_encode([
'ecosystem' => 'telegram',
'sku' => 'TG-STR-250',
'target' => '@customer_id',
]),
]);
$result = json_decode((string) curl_exec($ch), true);
import requests, uuid
res = requests.post(
"https://0panel.com/api/v1/orders",
headers={
"Authorization": "Bearer zp_live_YOUR_API_KEY",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"ecosystem": "gaming-uid",
"sku": "PUBG-325",
"target": "5148293041",
},
timeout=12,
)
print(res.json())
const res = await fetch("https://0panel.com/api/v1/orders", {
method: "POST",
headers: {
"Authorization": "Bearer zp_live_YOUR_API_KEY",
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
ecosystem: "ai-api",
sku: "OR-15USD",
label: "prod-bot-key",
}),
});
console.log(await res.json());
Webhook HMAC-SHA256
کپی کد
// Verify X-ZP-Signature on your Webhook receiver (PHP)
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_ZP_SIGNATURE'] ?? '';
$expected = hash_hmac('sha256', $rawBody, $YOUR_WEBHOOK_SECRET);
if (!hash_equals($expected, $signature)) {
http_response_code(403);
exit('Invalid signature');
}
$event = json_decode($rawBody, true);
// $event['event'] => 'otp.received' | 'order.completed' | 'order.refunded'