Bayilik
Bir müşterinin bayi durumunu ve bayi programının kurulum genelindeki ayarlarını yöneten beş uç.
Genel Bakış
Bayilik, bir müşterinin sizden indirimli alıp kendi müşterilerine satmasıdır. Bu uçlar iki ayrı katmanı yönetir ve karıştırılmamalıdır.
İlk üç uç tek bir müşteriye bakar: o müşterinin bayi durumu, kredi eşiği ve indirim kademeleri. Son iki uç programın kendisini yönetir: başvurular nasıl onaylanır, doğrulama zorunlu mudur, bayilere API erişimi verilir mi. Adres içinde müşteri kimliği olup olmaması bu ayrımı gösterir.
Referans
Bayi Durumunu Getirme
Müşterinin bayi durumunu ve kendisine özel bayi ayarlarını döndürür.
active ya da inactive.curl 'https://panel.ornek.com/api/v1/admin/clients/42/reseller' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/reseller', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();
// Bayi kaydi yoksa yanit tek alanlidir.
if (!body.data.is_reseller) return;$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/reseller');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->GetClientReseller(['id' => 42]);
// Diger alanlar yalnizca bayi kaydi varken gelir — null-safe okuyun.
$minCredit = $response['data']['min_credit']['amount'] ?? 0;{
"data": {
"is_reseller": true,
"status": "active",
"activation_time": "2026-02-01 12:00:00",
"min_credit": { "amount": 100.00, "currency_id": 840 },
"min_discount": { "amount": 50.00, "currency_id": 840 },
"only_credit_payment": false,
"discounts": {
"5": [{ "from": 1, "to": 10, "rate": 15.0 }]
}
}
}{
"data": {
"is_reseller": false
}
}Bayi Ayarlarını Kaydetme
Müşteriye özel bayi ayarlarını kaydeder ve bayiliği açıp kapatır.
curl -X PATCH 'https://panel.ornek.com/api/v1/admin/clients/42/reseller' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"active":true,"min_credit":{"amount":100,"currency_id":840},"only_credit_payment":true}'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/reseller', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
active: true,
min_credit: { amount: 100, currency_id: 840 },
only_credit_payment: true,
discounts: {
5: [{ from: 1, to: 10, rate: 15 }],
},
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/reseller');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'active' => true,
'min_credit' => ['amount' => 100, 'currency_id' => 840],
'only_credit_payment' => true,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Bayilik acikken gondermediginiz ayar KISITI KALDIRIR — once mevcut hali okuyun.
$current = Api::Clients()->GetClientReseller(['id' => 42])['data'];
$response = Api::Clients()->UpdateClientReseller([
'id' => 42,
'active' => true,
'min_credit' => $current['min_credit'],
'min_discount' => $current['min_discount'],
'only_credit_payment' => true,
'discounts' => $current['discounts'],
]);Bayi Durumunu Değiştirme
Var olan bir bayi kaydını açıp kapatır. Ayarlar olduğu gibi kalır.
activate ya da terminate.action iki değerden biri değil.curl -X PUT 'https://panel.ornek.com/api/v1/admin/clients/42/reseller/status' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"action":"activate"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/42/reseller/status', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ action: 'activate' }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/42/reseller/status');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['action' => 'activate']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->SetClientResellerStatus([
'id' => 42,
'action' => 'activate',
]);Program Ayarlarını Getirme
Bayi programının kurulum genelindeki ayarlarını döndürür. Tek bir müşteriye bakmaz.
manuel ya da auto.curl 'https://panel.ornek.com/api/v1/admin/clients/reseller/config' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/reseller/config', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/reseller/config');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->GetResellerConfig();Program Ayarlarını Kaydetme
Bayi programının kurulum genelindeki ayarlarını kaydeder.
manual, automatic ya da auto. Tanınmayan değer elle onaya düşer.curl -X PUT 'https://panel.ornek.com/api/v1/admin/clients/reseller/config' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"enabled":true,"activation":"manual","api_access":true}'const res = await fetch('https://panel.ornek.com/api/v1/admin/clients/reseller/config', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
enabled: true,
activation: 'manual',
api_access: true,
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/clients/reseller/config');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'enabled' => true,
'activation' => 'manual',
'api_access' => true,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);$response = Api::Clients()->SaveResellerConfig([
'enabled' => true,
'activation' => 'manual',
'api_access' => true,
]);Tuzaklar
Bayilik açıkken ayarları kaydederseniz, gönderilmeyen bir kısıt silinir; eski değeri korunmaz. Yalnız ödeme kısıtını değiştirmek isterken kredi eşiğini göndermeyi unutmak o eşiği kaldırır. Önce mevcut ayarları okuyun, üzerinde değişikliği yapın, tamamını geri gönderin.
Müşterinin bayi kaydı yoksa durum ucu yalnız is_reseller döndürür; diğer alanlar hiç gelmez. Bunları doğrudan okumak yerine null-safe erişin, yoksa bayi olmayan her müşteride hata alırsınız.
Hızlı açma ucu yalnız var olan bir kaydı değiştirir; kaydı olmayan müşteride not_reseller döner. Yeni bir bayi açmak ayarlar ucunun işidir.
İlgili Makaleler
Geri bildiriminiz için teşekkürler!
Yukarıda bulamadığınız her şey için destek ekibimiz her zaman yanınızda.