forked from fewhakko/Promptpay-QR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_fewza.php
28 lines (24 loc) · 997 Bytes
/
_fewza.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
<?php
require_once("lib/PromptPayQR.php");
error_reporting(0);
$response = array();
if(isset($_GET['qr-code'])) {
if(empty($_POST['percent']) || empty($_POST['money'])) {
$response["status"] = 'error';
$response["message"] = 'กรุณาอย่าเว้นช่องว่าง';
}
if (strlen($_POST['percent']) == 13 || strlen($_POST['percent']) == 10) {
$PromptPayQR = new PromptPayQR(); // new object
$PromptPayQR->size = 8; // Set QR code size to 8
$PromptPayQR->id = $_POST['percent']; // PromptPay ID
$PromptPayQR->amount = $_POST['money'].'.00'; // Set amount (not necessary)
$response["status"] = "success";
$response["base64za"] = $PromptPayQR->generate();
}
else {
$response["status"] = 'error';
$response["message"] = 'ท่านได้กรอกเบอร์หรือเลขบัตรประชาชนไม่ถูกต้อง';
}
}
echo json_encode($response);
?>