-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckoutProcess.php
More file actions
39 lines (35 loc) · 912 Bytes
/
checkoutProcess.php
File metadata and controls
39 lines (35 loc) · 912 Bytes
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
<?php
$order_id = uniqid();
$merchant_id = "1227714";
$name = isset($_POST["name"]) ? $_POST["name"] : '';
$price = isset($_POST["price"]) ? $_POST["price"] : 0.0;
$currency = "LKR";
$merchant_secret = "MzI3OTU4MDE2ODI5NzM5Nzg4MDQ3MjYxMjU4NjQxOTE0MDQ2NjA4";
if (empty($name) || empty($price)) {
$response = array(
"success" => false,
"message" => "Name or price is missing"
);
echo json_encode($response);
exit();
}
$hash = strtoupper(
md5(
$merchant_id .
$order_id .
number_format($price, 2, '.', '') .
$currency .
strtoupper(md5($merchant_secret))
)
);
$response = array(
"success" => true,
"order_id" => $order_id,
"merchant_id" => $merchant_id,
"name" => $name,
"price" => $price,
"currency" => $currency,
"hash" => $hash
);
echo json_encode($response);
?>