snippet shown on the onboarding * success page into their site. Here we resolve a connected school, ensure it * has a public embed key, and render that exact snippet so you can test the * full cross-site flow (embed.js → pay-frame.php → order-api.php) locally. * * ?school=Name to force one, ?amount=25.00 to set the amount. */ require_once __DIR__ . '/lib/SquareClient.php'; require_once __DIR__ . '/lib/MerchantStore.php'; $config = require __DIR__ . '/config.php'; $store = new MerchantStore($config); $requested = isset($_GET['school']) ? trim((string)$_GET['school']) : ''; $school = null; if ($requested !== '' && ($store->getMeta($requested)['merchant_id'] ?? null)) { $school = $requested; } else { foreach ($store->merchantSchools() as $s) { $school = $s; break; } } $amount = isset($_GET['amount']) && is_numeric($_GET['amount']) ? number_format((float)$_GET['amount'], 2, '.', '') : '25.00'; $key = $school !== null ? $store->merchantKey($school) : ''; $base = rtrim($config['base_url'], '/') . '/'; ?>
(This page imitates a school's own website. The only Square-specific thing on it is the one script tag below.)
Amount due: CAD = htmlspecialchars($amount) ?> — = htmlspecialchars($school ?? 'no connected school') ?>
No Square-connected school found. Complete onboard.php first.
Embed key in use: = htmlspecialchars($key ?: '(none)') ?>