get("accounts", ["[>]authkeys" => ["accountid"]], "accounts.accountid", ["key" => $VARS["key"]]); $amount = $VARS["amount"] * 1.0; if ($amount <= 0 || $amount > 999.99) { sendJsonResp($Strings->get("Amount must be more than zero and less than 999.99.", false), "ERROR"); } do { $txcode = substr(hash("sha256", random_bytes(100)), 0, 20); } while ($database->has("merchant_transactions", ["txcode" => $txcode])); $database->insert("merchant_transactions", ["txcode" => $txcode, "amount" => $amount, "merchantid" => $accountid]); exitWithJson([ "status" => "OK", "txcode" => $txcode, "amount" => $amount ]);