Hatalar
Partner API hataları HTTP status kodları ve JSON hata mesajları kullanır.
400: geçersiz body, desteklenmeyen para birimi, eksikcustomer.username, eksikcustomer.fullName, eksikredirectUrl, geçersiz IBAN, geçersiz tutar veya platform geneli deposit/withdrawal limitleri dışında tutar.401: eksik API anahtarı, eksik imza header’ları, eski timestamp veya geçersiz HMAC imzası.403: kimliği doğrulanan casino API key’i pasif veya istenen işlem bu casino scope’una ait değil.404: kimliği doğrulanan casino scope’unda işlem bulunamadı.409: aynı casino ve işlem tipi için tekrarlananexternalReference.
{
"error": "Deposit tutarı en az 100.00 TRY olmalıdır"
}
API hatalarını işle
async function azPayJson(url, options) {
const response = await fetch(url, options);
const payload = await response.json().catch(() => ({}));
if (!response.ok) {
if (response.status === 401) throw new Error('API key, timestamp, apiSecret ve hashSecret imzasını kontrol edin');
if (response.status === 409) throw new Error('Tekrarlanan externalReference; yeni işlem oluşturmak yerine mevcut işlemi yükleyin');
throw new Error(payload.error || 'A-ZPay API hatası');
}
return payload;
}<?php
function assertAZPaySuccess(string $responseBody, int $status): array {
$payload = json_decode($responseBody, true) ?: [];
if ($status >= 200 && $status < 300) return $payload;
if ($status === 401) throw new RuntimeException('API key, timestamp, apiSecret ve hashSecret imzasını kontrol edin');
if ($status === 409) throw new RuntimeException('Tekrarlanan externalReference; yeni işlem oluşturmak yerine mevcut işlemi yükleyin');
throw new RuntimeException($payload['error'] ?? 'A-ZPay API hatası');
}Hosted ödeme sayfası yönlendirmesi yalnızca oyuncunun transferi gönderdim butonuna bastığını gösterir. Oyuncu bakiyesini yalnızca doğrulanmış imzalı webhook geldikten sonra güncelleyin.