'success', 'message' => 'Google Calendar connected successfully.']; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rsv_google_settings_nonce'])) { if (!wp_verify_nonce($_POST['rsv_google_settings_nonce'], 'rsv_google_settings')) { wp_die('Security check failed.'); } if (isset($_POST['rsv_disconnect'])) { $service->disconnect(); $notice = ['type' => 'success', 'message' => 'Disconnected from Google Calendar.']; } elseif (isset($_POST['rsv_register_webhook'])) { $result = $service->register_webhook(); $notice = isset($result['id']) ? ['type' => 'success', 'message' => 'Webhook registered.'] : ['type' => 'error', 'message' => 'Webhook registration failed: ' . ($result['error'] ?? json_encode($result))]; } elseif (isset($_POST['rsv_stop_webhook'])) { $service->stop_webhook(); $notice = ['type' => 'success', 'message' => 'Webhook stopped.']; } else { update_option('rsv_google_client_id', sanitize_text_field($_POST['rsv_google_client_id'] ?? '')); update_option('rsv_google_calendar_id', sanitize_text_field($_POST['rsv_google_calendar_id'] ?? 'primary')); // Only overwrite the (encrypted) client secret when a new value is // supplied — the field renders blank, so otherwise saving any other // setting would wipe the stored secret. $client_secret = sanitize_text_field($_POST['rsv_google_client_secret'] ?? ''); if ($client_secret !== '') { $service->set_client_secret($client_secret); } $notice = ['type' => 'success', 'message' => 'Settings saved.']; } } $connected = $service->is_google_connected(); $webhook_registered = $service->is_webhook_registered(); $webhook_expiry = (int) get_option('rsv_google_webhook_expiration', 0); $client_id = esc_attr(get_option('rsv_google_client_id', '')); $cal_id = esc_attr(get_option('rsv_google_calendar_id', 'primary')); $oauth_url = esc_url($service->get_oauth_url()); ?>

Google Calendar

OAuth Credentials

Create a project in Google Cloud Console, enable the Google Calendar API, and create OAuth 2.0 credentials. Set the authorised redirect URI to .

Use primary for the account's main calendar, or paste a specific calendar ID from Google Calendar settings.


Connection

✔ Connected to Google Calendar.

✘ Not connected.

Connect with Google

You must save the Client ID and Secret first.


Webhook

The webhook lets Google Calendar notify this site when you confirm or cancel a reservation event, so the reservation state is updated automatically.

Webhook URL:

HTTPS required. Google Calendar only accepts webhook URLs served over HTTPS. This site is currently on HTTP, so webhook registration will be rejected by Google. Use a publicly accessible HTTPS address in production.

✔ Webhook active. Expires .

✘ Webhook not registered.