isset($_POST['stripe_enabled']), 'test_mode' => isset($_POST['stripe_test_mode']), 'publishable_key' => trim($_POST['stripe_publishable_key'] ?? ''), 'secret_key' => trim($_POST['stripe_secret_key'] ?? ''), 'webhook_secret' => trim($_POST['stripe_webhook_secret'] ?? '') ]); setFlash('success', 'Stripe settings updated'); } if ($section === 'square') { setSetting('payment_square', [ 'enabled' => isset($_POST['square_enabled']), 'sandbox' => isset($_POST['square_sandbox']), 'app_id' => trim($_POST['square_app_id'] ?? ''), 'location_id' => trim($_POST['square_location_id'] ?? ''), 'access_token' => trim($_POST['square_access_token'] ?? ''), 'webhook_signature_key' => trim($_POST['square_webhook_signature_key'] ?? '') ]); setFlash('success', 'Square settings updated'); } if ($section === 'methods') { setSetting('payment_methods', [ 'card' => isset($_POST['method_card']), 'cash' => isset($_POST['method_cash']), 'wallet' => isset($_POST['method_wallet']), 'gift_card' => isset($_POST['method_gift_card']) ]); setFlash('success', 'Payment methods updated'); } header('Location: /admin/payments.php'); exit; } $stripe = getSetting('payment_stripe', [ 'enabled' => true, 'test_mode' => true, 'publishable_key' => '', 'secret_key' => '', 'webhook_secret' => '' ]); $square = getSetting('payment_square', [ 'enabled' => defined('PAYMENT_PROCESSOR') && PAYMENT_PROCESSOR === 'square', 'sandbox' => defined('SQUARE_ENV') && SQUARE_ENV === 'sandbox', 'app_id' => defined('SQUARE_APP_ID') ? SQUARE_APP_ID : '', 'location_id' => defined('SQUARE_LOCATION_ID') ? SQUARE_LOCATION_ID : '', 'access_token' => defined('SQUARE_ACCESS_TOKEN') ? SQUARE_ACCESS_TOKEN : '', 'webhook_signature_key' => defined('SQUARE_WEBHOOK_SIGNATURE_KEY') ? SQUARE_WEBHOOK_SIGNATURE_KEY : '' ]); $methods = getSetting('payment_methods', [ 'card' => true, 'cash' => true, 'wallet' => true, 'gift_card' => true ]); ?>