if (!$param["clientid"] == false) { // tambah credit $payments = new payments(); $topup = json_decode($payments->Add_Credit($param)); //membuat invoice $invoice["userid"] = $param["clientid"]; $invoice["date"] = date("Ymd"); $invoice["duedate"] = date("Ymd"); $invoice["sendinvoice"] = false; $invoice["itemdescription1"] = $param["description"]; $invoice["itemamount1"] = $param["amount"]; $createInvoice = json_decode($payments->Create_Invoice($invoice)); // update invoice $postfields["invoiceid"] = $createInvoice->invoiceid; $postfields["status"] = 'Paid'; $updateInvoice = json_decode($payments->Update_Invoice($postfields)); if ($updateInvoice->result == 1) { $result['result'] = 1; echo json_encode($result); } else { $result['result'] = 0; echo json_encode($result); } // $param["clientid"] } else { $result['result'] = 0; echo json_encode($result); } // end $param["clientid"] // $cekCardId } else {
<?php if ($_POST) { $payments = new payments(); $param["invoiceid"] = $_POST['invoiceid']; $param["itemdescription[1]"] = $_POST['daftar_pesanan']; $param["itemamount[1]"] = $_POST['nominal']; $updateInvoice = json_decode($payments->Update_Invoice($param)); if ($updateInvoice->result == '1') { $result['result'] = $updateInvoice->result; $result['invoiceid'] = $updateInvoice->invoiceid; $result['message'] = ""; } else { $result['result'] = $updateInvoice->result; $result['message'] = $updateInvoice->message; } echo json_encode($result); } else { $result['result'] = 0; $result['message'] = "Method not accepted"; echo json_encode($result); }