-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsendmoney_backend.php
69 lines (49 loc) · 1.35 KB
/
sendmoney_backend.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
59
60
61
62
63
64
65
66
67
68
69
<?php
include "includes/db_conn.php";
include "includes/utilities.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$source = $_POST['source'];
$destination = $_POST['destination'];
$sendamount = $_POST['sendamount'];
$body = [
"amount" => "$sendamount",
"currency" => "INR",
"source_ewallet" => "$source",
"destination_ewallet" => "$destination",
"metadata" => [
"merchant_defined" => true
],
];
// var_dump(json_encode($body));
try {
$sendmoney = make_request('post', '/v1/account/transfer', $body);
//var_dump($sendmoney);
var_dump(json_encode($sendmoney));
// echo $sendmoney["data"]["id"];
// echo $sendmoney["data"]["status"];
$send_id = $sendmoney["data"]["id"];
$accepted = [
"id" => "$send_id",
"metadata" => [
"merchant_defined" => "accepted"
],
"status" => "accept"
];
try {
$acceptsend = make_request('post', '/v1/account/transfer/response', $accepted);
// var_dump($acceptsend);
// var_dump(json_encode($acceptsend));
} catch(Exception $e) {
echo "Error: $e";
}
header("Location: wallet.php");
exit();
} catch(Exception $e) {
echo "Error: $e";
}
}
else {
header("Location: wallet.php");
exit();
}
?>