// redirect if not logged in if (!isset($_SESSION['merchant_id'])) { header('Location: ../login.php'); exit; } // fetch merchant info $id = $_SESSION['merchant_id']; $stmt = $conn->prepare("SELECT name,email,receiving_wallet,kyc_status FROM merchants WHERE id=? LIMIT 1"); $stmt->bind_param("i", $id); $stmt->execute(); $res = $stmt->get_result(); $merchant = $res->fetch_assoc(); if (!$merchant || $merchant['kyc_status'] !== 'verified') { echo ""; exit; } $msg = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $amount = floatval($_POST['amount']); if ($amount > 0) { $payment_ref = 'MXN' . strtoupper(uniqid()); $platform_fee = round($amount * 0.0007, 4); $total = $amount + $platform_fee; $qr_link = "https://myxenpay.finance/pay.php?ref={$payment_ref}"; require_once __DIR__ . '/../vendor/autoload.php'; use Endroid\QrCode\Builder\Builder; use Endroid\QrCode\Writer\PngWriter; use Endroid\QrCode\Encoding\Encoding; use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh; $fileName = 'qr_' . $payment_ref . '.png'; $dir = __DIR__ . '/../assets/qrcodes/'; if (!is_dir($dir)) mkdir($dir, 0775, true); $filePath = $dir . $fileName; $result = Builder::create() ->writer(new PngWriter()) ->data($qr_link) ->encoding(new Encoding('UTF-8')) ->errorCorrectionLevel(new ErrorCorrectionLevelHigh()) ->size(240) ->margin(8) ->build(); $result->saveToFile($filePath); $stmt = $conn->prepare("INSERT INTO qr_payments (merchant_id,amount,platform_fee,total_amount,qr_code,status,payment_ref) VALUES (?,?,?,?,?,'pending',?)"); $stmt->bind_param("idddss", $id, $amount, $platform_fee, $total, $fileName, $payment_ref); $stmt->execute(); $msg = "
"; } else { $msg = "
Email:
Warning: Undefined variable $merchant in /home/myxenpay/public_html/merchant-dashboard.php on line 108
Warning: Trying to access array offset on value of type null in /home/myxenpay/public_html/merchant-dashboard.php on line 108
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/myxenpay/public_html/merchant-dashboard.php on line 108
Receiving Wallet:
Warning: Undefined variable $merchant in /home/myxenpay/public_html/merchant-dashboard.php on line 109
Warning: Trying to access array offset on value of type null in /home/myxenpay/public_html/merchant-dashboard.php on line 109
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /home/myxenpay/public_html/merchant-dashboard.php on line 109