API dokümanı
Ürün listesini çek, bakiyeni sorgula ve sipariş ver — kendi sitende veya botunda otomatik satış yap. API erişimi için önce hesabından talep oluşturmalısın.
Kimlik doğrulama
Her istekte API anahtarını Authorization header'ında gönder. Anahtarlar dpk_ ile başlar ve sadece oluşturulduğu anda gösterilir.
Authorization: Bearer dpk_xxxxxxxxxxxxxxxx
Temel adres: https://fragkey.co.uk/api/v1 · Tüm yanıtlar JSON. Dakikada 60 istek limiti vardır.
Endpoint'ler
| Metot | Yol | Açıklama |
|---|---|---|
| GET | /balance | Bakiye |
| GET | /products | Ürünler (rolüne göre fiyat, stok). ?category=slug |
| GET | /products/{id} | Ürün detayı |
| POST | /orders | Sipariş oluştur |
| GET | /orders | Siparişler. ?page=1&per_page=25 |
| GET | /orders/{id|order_no} | Sipariş + teslim edilen içerik |
Hata kodları
- 401 UNAUTHORIZED
- Anahtar eksik veya geçersiz
- 403 API_ACCESS_DISABLED
- API erişimin onaylı değil veya askıda
- 403 IP_NOT_ALLOWED
- İstek izinli IP listesinde değil
- 402 INSUFFICIENT_BALANCE
- Bakiye yetersiz
- 409 OUT_OF_STOCK
- Yeterli stok yok
- 422 INVALID_QUANTITY
- Adet ürün limitleri dışında
- 429 RATE_LIMITED
- Limit aşıldı,
Retry-Afterkadar bekle
Sipariş oluşturma
Aynı isteği tekrar gönderdiğinde çift sipariş oluşmaması için her siparişe benzersiz bir Idempotency-Key ver. Aynı anahtarla gelen ikinci istek ilk siparişi döndürür.
curl -X POST https://fragkey.co.uk/api/v1/orders \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: siparis-10001" \
-d '{"product_id": 1, "quantity": 1}'
Yanıt
{
"success": true,
"data": {
"id": 42,
"order_no": "EP261031A1B2C3",
"status": "completed",
"product_name": "ChatGPT Plus 1 Ay",
"format": "credential",
"quantity": 1,
"unit_price": 299.9,
"total": 299.9,
"items": ["kullanici@mail.com:sifre"]
}
}
Ürün customer_input.required: true döndürüyorsa (ör. davet gönderilecek e-posta veya kullanıcı adı) sipariş gövdesine "customer_input": "ornek@mail.com" ekle; eksik veya geçersizse 422 CUSTOMER_INPUT_REQUIRED / INVALID_CUSTOMER_INPUT döner.
Manuel teslim ürünlerde status önce pending döner; teslim edilince GET /orders/{id} ile items dolu gelir.
PHP örneği
$ch = curl_init('https://fragkey.co.uk/api/v1/products');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer dpk_xxx'],
]);
$response = json_decode(curl_exec($ch), true);
foreach ($response['data'] as $product) {
echo $product['name'] . ' - ' . $product['price'] . PHP_EOL;
}