-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.php
60 lines (39 loc) · 1.11 KB
/
log.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
52
53
54
55
56
57
58
<?php
use App\Bkash;
require_once 'vendor/autoload.php';
$json = ['error' => true, 'data' => null];
try {
$bKash = Bkash::builder()
->setSandbox(false)
->setUsername('username')
->setPassword('password')
->setAppKey('appkey')
->setAppSecret('appsecret')
->build();
switch (@$_GET['action']) {
case 'create': {
$amount = $_GET['amount'] ?? '120.40';
$resp = $bKash->create(uniqid('INV'), $amount);
if (!$resp->getErrorCode()) {
$json['error'] = false;
}
$json['data'] = $resp->toArray();
break;
}
case 'execute': {
$payId = $_GET['paymentID'] ?? '';
$resp = $bKash->execute($payId);
if (!$resp->getErrorCode()) {
$json['error'] = false;
}
$json['data'] = $resp->toArray();
break;
}
default: {
$json['data'] = 'Unknown action';
}
};
} catch (\Exception $e) {
var_dump($e->getMessage());
}
echo json_encode($json);