-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
51 lines (39 loc) · 1.42 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require_once('../brain/Starting.php');
require_once('hipopay.php');
if (! $User->JID > 0) {
echo "Bu alanı sadece giriş yapmış kullanıcılarımız görebilir.";
exit;
} else {
date_default_timezone_set('Europe/Istanbul');
$hipopaySettings = $panelDb->table('api_hipopay_settings')
->where('is_active', 1)
->orderBy('id', 'desc')
->first();
if (!$hipopaySettings) {
die('Hipopay ayarları bulunamadı!');
}
$userID = $User->JID;
$username = $User->StrUserID;
$userEmail = $User->Email;
$hipopay = new HipopayIntegration();
$hipopay->setApiKey($hipopaySettings->api_key);
$hipopay->setApiSecret($hipopaySettings->api_secret);
$hipopay->setUserId($userID);
$hipopay->setUserEmail($userEmail);
$hipopay->setUsername($username);
try {
$response = $hipopay->createStoreSession();
if (isset($response['success']) && $response['success']===true) {
if (isset($response['data']['payment_url'])) {
header('Location: '.$response['data']['payment_url']);
} else {
echo 'Hata: Ödeme URL\'si bulunamadı.';
}
} else {
echo 'Hata: '.(isset($response['message']) ? $response['message'] : 'Bir hata oluştu');
}
} catch (Exception $e) {
echo 'Hata: ' . $e->getMessage();
}
}