-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipn.php
42 lines (31 loc) · 1.14 KB
/
ipn.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
<?php
include_once 'config.php';
error_reporting(0);
ini_set('display_errors', 0);
header('X-Developed-By: SSLWireless');
header('Content-Type: application/json');
$status = $_POST['status'];
if ($status == 'VALID') {
$validationUrl = API_URL . "/validator/api/validationserverAPI.php";
$data = [
'val_id' => $_POST['val_id'],
'store_id' => STORE_ID,
'store_passwd' => STORE_PASSWD,
'format' => 'json',
];
$queryString = http_build_query($data);
$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $validationUrl . "?" . $queryString);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($handle);
curl_close($handle);
$content = json_decode($return);
$valStatus = $content->status;
if (in_array($valStatus, ['VALID', 'VALIDATED'])) {
echo json_encode(["error" => "0000", "msg" => "Validation successful from IPN"]);
} else {
echo json_encode(["error" => "1001", "msg" => "Validation failed from IPN"]);
}
} else {
echo json_encode(["error" => "1002", "msg" => "Transaction is " . $status]);
}