getMeta($requested)['merchant_id'] ?? null)) {
$school = $requested;
} else {
$all = $store->merchantSchools();
if (!empty($all)) $school = $all[0];
}
$amount = isset($_GET['amount']) && is_numeric($_GET['amount']) ? number_format((float)$_GET['amount'], 2, '.', '') : '25.00';
$schoolLabel = $school ?? '(no connected school found)';
?>
Pay — = htmlspecialchars($schoolLabel) ?>
School Lunch Payment
Paying = htmlspecialchars($schoolLabel) ?>
TotalCAD = htmlspecialchars($amount) ?>
'
. 'No Square-connected school found. Complete onboarding first '
. '(onboard.php), then reload this page.
';
} else {
$sqCheckout = [
'school_name' => $school,
'amount' => $amount,
'currency' => 'CAD',
'order_api_url' => './order-api.php',
'success_url' => './demo-checkout.php?school=' . urlencode($school),
];
require __DIR__ . '/square-checkout-widget.php';
}
?>