· 5 years ago · Jan 09, 2021, 07:38 AM
1<?php
2/*
3{
4"api_key":"xxxx-xxxx-xxxx-xxxx-xxxx",
5"bank":"bca",
6"account":"018xxxxxx",
7"amount":"1000000",
8"type":"CR", // CR/DB
9"keterangan":"Berita transfer",
10"tanggal":"01/08/2020"
11}
12*/
13
14$cekdata = array(
15"api_key" => "isi dengan api key"
16);
17
18$responseBody = file_get_contents('php://input');
19$dataBody = json_decode($responseBody, true);
20if (!$dataBody) {
21exit;
22}
23
24if ($dataBody["api_key"] == '' || !isset($dataBody["api_key"])) {
25exit;
26}
27// validasi API Key
28if( $cekdata['api_key'] != $dataBody["api_key"]) {
29exit("Invalid Api Key");
30}
31
32// dana masuk
33if($dataBody ["type"] == "CR") {
34//query MySQL pengecekan apakah dana masuk sesuai nominal dan jenis banknya
35
36}
37
38
39?>