Partner API Referansı
Bu referans yalnızca partner entegrasyonu içindir. Casino geliştiricilerinin kullandığı imzalı makineden makineye API’yi dokümante eder. Partner dışı endpoint’ler bu referansın parçası değildir.
Kimlik doğrulama
Aşağıdaki her istek casino’ya ait apiKey, apiSecret ve hashSecret ile imzalanmalıdır.
<timestamp>.<METHOD>.<path>.<raw_body>.<hashSecret>
GET isteklerinde raw_body boş string olur ama sondaki .<hashSecret> segmenti yine zorunludur. hashSecret eklenmeyen eski imzalar reddedilir.
import crypto from 'node:crypto';
const API_KEY = 'pk_live_xxx';
const API_SECRET = 'sk_live_xxx';
const HASH_SECRET = 'hs_live_xxx';
function signRequest(method, path, body = '') {
const timestamp = Math.floor(Date.now() / 1000).toString();
const canonical = [timestamp, method.toUpperCase(), path, body, HASH_SECRET].join('.');
const signature = crypto.createHmac('sha256', API_SECRET).update(canonical).digest('hex');
return {
'content-type': 'application/json',
'x-api-key': API_KEY,
'x-timestamp': timestamp,
'x-signature': signature,
};
}<?php
$apiKey = 'pk_live_xxx';
$apiSecret = 'sk_live_xxx';
$hashSecret = 'hs_live_xxx';
function signRequest(string $method, string $path, string $body = ''): array {
global $apiKey, $apiSecret, $hashSecret;
$timestamp = (string) time();
$canonical = implode('.', [$timestamp, strtoupper($method), $path, $body, $hashSecret]);
$signature = hash_hmac('sha256', $canonical, $apiSecret);
return [
'content-type: application/json',
'x-api-key: ' . $apiKey,
'x-timestamp: ' . $timestamp,
'x-signature: ' . $signature,
];
}Müşteri kimlik alanları
Para yatırma ve çekme isteklerinde customer şunları içermelidir:
id: casino tarafındaki kalıcı oyuncu ID’si.username: operatörlerin gördüğü casino kullanıcı adı.fullName: operatörlerin gördüğü tam ad / hesap sahibi adı.
email, firstName ve lastName gibi alanlar opsiyoneldir ancak fullName yerine geçmez.
Global tutar limitleri
A-ZPay adminleri para yatırma ve çekme için platform genelinde TRY minimum ve maksimum tutarlar belirler. Bu limitlerin dışındaki istekler hosted ödeme talimatı veya operatör kuyruğu oluşturulmadan reddedilir.
- Deposit minimum altı:
400 { "error": "Deposit amount is below the platform minimum" }. - Deposit maksimum üstü:
400 { "error": "Deposit amount exceeds the platform maximum" }. - Withdrawal minimum altı:
400 { "error": "Withdrawal amount is below the platform minimum" }. - Withdrawal maksimum üstü:
400 { "error": "Withdrawal amount exceeds the platform maximum" }.
Oyuncular para göndermeye çalışmadan önce izin verilen aralığı görsün diye tutarı casino cashier içinde doğrulayın.
İstekler
/v1/depositsTRY banka transferi yatırımı oluşturur ve oyuncu için hosted ödeme URL’i döner.
- Zorunlu:
amount,externalReference,redirectUrl,customer.id,customer.username,customer.fullName. currencyvarsayılan olarakTRY; banka hesabı routing’i tüm casinolar arasında global round-robin çalışır.- Talep edilen
amount, operatörün onayladığı gerçek tutardan farklı olabilir. Oyuncuya yalnızca imzalı webhook alanlarına göre kredi verin.
const path = '/v1/deposits';
const payload = {
amount: '1000.00',
currency: 'TRY',
externalReference: 'casino-deposit-1001',
redirectUrl: 'https://casino.example/cashier/deposits/1001',
customer: {
id: 'player-42',
username: 'luckyplayer',
fullName: 'Ayse Yilmaz',
email: 'player@example.com'
}
};
const body = JSON.stringify(payload);
const response = await fetch('https://api.azpay.example' + path, {
method: 'POST',
headers: signRequest('POST', path, body),
body
});
const result = await response.json();
// result.transaction.hostedUrl oyuncuya açılacak URL'dir.<?php
$path = '/v1/deposits';
$payload = [
'amount' => '1000.00',
'currency' => 'TRY',
'externalReference' => 'casino-deposit-1001',
'redirectUrl' => 'https://casino.example/cashier/deposits/1001',
'customer' => [
'id' => 'player-42',
'username' => 'luckyplayer',
'fullName' => 'Ayse Yilmaz',
'email' => 'player@example.com',
],
];
$body = json_encode($payload, JSON_UNESCAPED_SLASHES);
$ch = curl_init('https://api.azpay.example' . $path);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => signRequest('POST', $path, $body),
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
// $result['transaction']['hostedUrl'] oyuncu URL'idir./v1/withdrawalsA-ZPay operatör onayı için TRY para çekme talebi oluşturur.
- Zorunlu:
amount,externalReference,customer.id,customer.username,customer.fullName. - Zorunlu ödeme bilgileri:
withdrawalAccount.accountHolderNamevewithdrawalAccount.iban. - Onay/ret sonucu imzalı webhook ile iletilir; partnerlere hosted payment page API’i açılmaz.
const path = '/v1/withdrawals';
const payload = {
amount: '750.00',
currency: 'TRY',
externalReference: 'casino-withdrawal-2001',
customer: { id: 'player-42', username: 'luckyplayer', fullName: 'Ayse Yilmaz' },
withdrawalAccount: {
bankName: 'Garanti BBVA',
accountHolderName: 'Ayse Yilmaz',
iban: 'TR640006200027700006789011'
}
};
const body = JSON.stringify(payload);
const response = await fetch('https://api.azpay.example' + path, {
method: 'POST',
headers: signRequest('POST', path, body),
body
});
const result = await response.json();<?php
$path = '/v1/withdrawals';
$payload = [
'amount' => '750.00',
'currency' => 'TRY',
'externalReference' => 'casino-withdrawal-2001',
'customer' => ['id' => 'player-42', 'username' => 'luckyplayer', 'fullName' => 'Ayse Yilmaz'],
'withdrawalAccount' => [
'bankName' => 'Garanti BBVA',
'accountHolderName' => 'Ayse Yilmaz',
'iban' => 'TR640006200027700006789011',
],
];
$body = json_encode($payload, JSON_UNESCAPED_SLASHES);
$ch = curl_init('https://api.azpay.example' . $path);
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_HTTPHEADER => signRequest('POST', $path, $body), CURLOPT_POSTFIELDS => $body, CURLOPT_RETURNTRANSFER => true]);
$result = json_decode(curl_exec($ch), true);/v1/transactions/:idKimlik doğrulanan casino API key’ine ait tek bir işlemi döner.
const transactionId = 'txn_abc123';
const path = '/v1/transactions/' + encodeURIComponent(transactionId);
const response = await fetch('https://api.azpay.example' + path, {
method: 'GET',
headers: signRequest('GET', path, '')
});
const result = await response.json();<?php
$transactionId = 'txn_abc123';
$path = '/v1/transactions/' . rawurlencode($transactionId);
$ch = curl_init('https://api.azpay.example' . $path);
curl_setopt_array($ch, [CURLOPT_HTTPHEADER => signRequest('GET', $path, ''), CURLOPT_RETURNTRANSFER => true]);
$result = json_decode(curl_exec($ch), true);/partner/balanceCasino’nun imzalı mutabakat bakiyesini döner.
- Onaylı yatırımlar, onaylı çekimler, tamamlanan payoutlar ve manuel düzeltmeler casino ledgerına dahil olur.
- Bekleyen payout talepleri onaylanana veya reddedilene kadar kullanılabilir bakiyeden rezerve edilir.
const path = '/partner/balance';
const response = await fetch('https://api.azpay.example' + path, {
method: 'GET',
headers: signRequest('GET', path, '')
});
const { balance } = await response.json();<?php
$path = '/partner/balance';
$ch = curl_init('https://api.azpay.example' . $path);
curl_setopt_array($ch, [CURLOPT_HTTPHEADER => signRequest('GET', $path, ''), CURLOPT_RETURNTRANSFER => true]);
$balance = json_decode(curl_exec($ch), true)['balance'];/partner/transactionsMutabakat için partner scope işlem geçmişini döner.
- Filtreler:
status,type,q,from,to,page,pageSize. qID, referans, username, full name ve diğer müşteri metinlerinde arar.
const query = new URLSearchParams({ type: 'deposit', status: 'approved', page: '1', pageSize: '25' });
const path = '/partner/transactions?' + query.toString();
const response = await fetch('https://api.azpay.example' + path, {
method: 'GET',
headers: signRequest('GET', path, '')
});
const { transactions, pagination } = await response.json();<?php
$query = http_build_query(['type' => 'deposit', 'status' => 'approved', 'page' => 1, 'pageSize' => 25]);
$path = '/partner/transactions?' . $query;
$ch = curl_init('https://api.azpay.example' . $path);
curl_setopt_array($ch, [CURLOPT_HTTPHEADER => signRequest('GET', $path, ''), CURLOPT_RETURNTRANSFER => true]);
$result = json_decode(curl_exec($ch), true);Webhooklar
A-ZPay onaylanan/reddedilen deposit ve withdrawal işlemleri için imzalı webhook gönderir. Webhook imzasını aynı canonical string ile doğrulayın ve aynı casino hashSecret değerini son segment olarak ekleyin. Oyuncu bakiyesi güncellemelerinde webhook’u tek doğru kaynak kabul edin.
Deposit onaylarında gerçek gelen tutar, başlangıçta talep edilen tutardan farklı olabilir. Webhook payload’ları şunları içerir:
requestedAmountCents: cashier’da talep ettiğiniz tutar.actualAmountCents: A-ZPay operatörünün gerçekten geldiğini onayladığı brüt tutar. Daha düşük veya daha yüksek olabilir.amountDifferenceCents:actualAmountCents - requestedAmountCents.playerAmountCents: A-ZPay komisyonundan sonra oyuncuya kredilenecek tutar. Oyuncu bakiyesi için bunu kullanın.
import crypto from 'node:crypto';
function verifyWebhook(req, rawBody) {
const timestamp = req.headers['x-azpay-timestamp'];
const signature = req.headers['x-azpay-signature'];
const path = '/webhook/azpay';
const canonical = [timestamp, 'POST', path, rawBody, HASH_SECRET].join('.');
const expected = crypto.createHmac('sha256', API_SECRET).update(canonical).digest('hex');
if (!crypto.timingSafeEqual(Buffer.from(signature, 'hex'), Buffer.from(expected, 'hex'))) {
throw new Error('invalid webhook signature');
}
const event = JSON.parse(rawBody);
if (event.event === 'deposit.approved') {
const tx = event.data;
// requestedAmountCents ve actualAmountCents farklı olabilir.
// Tam olarak playerAmountCents kadar kredi verin.
creditPlayer(tx.customer.id, tx.playerAmountCents, tx.transactionId);
}
}<?php
$rawBody = file_get_contents('php://input');
$timestamp = $_SERVER['HTTP_X_AZPAY_TIMESTAMP'] ?? '';
$signature = $_SERVER['HTTP_X_AZPAY_SIGNATURE'] ?? '';
$path = '/webhook/azpay';
$canonical = implode('.', [$timestamp, 'POST', $path, $rawBody, $hashSecret]);
$expected = hash_hmac('sha256', $canonical, $apiSecret);
if (!hash_equals($expected, $signature)) {
http_response_code(401);
exit('invalid webhook signature');
}
$event = json_decode($rawBody, true);
if ($event['event'] === 'deposit.approved') {
$tx = $event['data'];
// requestedAmountCents ve actualAmountCents farklı olabilir.
// Tam olarak playerAmountCents kadar kredi verin.
creditPlayer($tx['customer']['id'], $tx['playerAmountCents'], $tx['transactionId']);
}
http_response_code(200);