Square Connection Monitor
WordPress plugin that monitors WooCommerce Square payment gateway and alerts you when payments go down
by Cloud Nine Web · github.com/edellingham/square-connection-monitor
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/edellingham/square-connection-monitor/archive/refs/heads/main.zipSquare Connection Monitor for WooCommerce
A WordPress plugin that monitors whether your WooCommerce Square payment gateway can actually process payments, and emails you when it can't.
The Problem
The WooCommerce Square plugin uses OAuth tokens that expire every 30-45 days. The built-in token refresh is unreliable -- when it silently fails, your checkout breaks and you don't find out until a customer complains (or worse, just leaves).
What This Plugin Does
Every hour (configurable), it asks WooCommerce Square directly: "Can you take a payment right now?"
It checks five things:
- Is the WooCommerce Square plugin active?
- Is the Square account connected? (OAuth token valid, not expired)
- Is a Square location selected?
- Is the Square gateway available at checkout?
- Has the token refresh explicitly failed? (
wc_square_refresh_failedflag)
If any check fails, you get an email with the specific reason. When it recovers, you get another email.
No external API calls. No tokens to configure. It reads WooCommerce's own internal state.
Installation
- Download
square-connection-monitor.php - Upload to
wp-content/plugins/on your WordPress site - Activate in Plugins
- Go to WooCommerce > Square Monitor to configure alert emails
Settings
| Setting | Default | Description |
|---|---|---|
| Alert Emails | Site admin email | One email per line. All addresses receive alerts. |
| Check Frequency | Every hour | How often to check (hourly, twice daily, daily). |
| Failures Before Alert | 2 | Consecutive failures required before sending an alert. Prevents false alarms from transient issues. |
How It Works
- Uses WooCommerce Action Scheduler (not WP-Cron) for reliable background execution
- Checks the Square gateway's
is_connected()andis_available()methods -- the same checks WooCommerce runs at checkout - Sends one "down" alert per outage (not one per check)
- Sends a "restored" alert when the connection comes back
- Shows a red admin notice on all WP admin pages while payments are down
- Includes a Check Now button for manual verification and a Send Test Alert button to confirm emails are working
Requirements
- WordPress 5.8+
- PHP 7.4+
- WooCommerce (any recent version -- Action Scheduler is bundled)
- WooCommerce Square plugin (the official one from WooCommerce)
License
GPL v2 or later