Part 5: Set Up Authenticated Cron — Administrator Only
Background jobs advance eligible subscription schedules, generate recurring links, process due collection, and handle reminders. A scheduler is essential for TruBuy-managed recurring methods and partial-payment reminders.
Operational warning: Running cron is not a read-only health check. It can send messages, update orders, and attempt configured recurring payments. Use an isolated test setup first and review due live work before authorizing a production run.
Option 1: WordPress Cron
- Open Gateway and Integration Settings and find WP Cron Job.
- Select an available interval, such as 5 or 15 minutes, and save.
- Verify that scheduled jobs actually execute on the host. WordPress’s ordinary traffic-triggered scheduler depends on visits unless the host invokes it independently.
The supplied interface includes Disable, 1 Minute, 5 Minutes, 10 Minutes, 15 Minutes, 30 Minutes, and 1 Hour. Choose an interval that matches your operational needs; a short interval is not a guarantee that email or gateway processing finishes immediately.
Option 2: External Scheduler
- As an administrator, open the subscription or Partial Payment Settings help and use the generated cron command/URL shown there.
- Copy the complete generated authenticated URL into the trusted scheduler. In this source it includes a
cron_key query parameter. Do not shorten it to the bare route. - Protect the command/URL as a secret. Restrict scheduler access and redact the key from logs, screenshots, support messages, and monitoring dashboards.
- Schedule an authorized GET call, commonly every 5 or 15 minutes. Advanced setups may send the same key in
X-TruBuy-Cron-Key instead of the URL, using a secret-capable scheduler. - Verify an authenticated run from the scheduler itself before switching off the old scheduling method. An administrator’s logged-in browser can pass the separate admin/session permission check, so it does not prove the external scheduler is authenticated.
Authentication required: The endpoint is /wp-json/nf-ipg/v1/cron-job/. An unauthenticated external call to the bare route is rejected with HTTP 403 and Invalid or missing cron key. A valid administrator session or the correct query/header key is required. No working key is published in this guide.
Verify, Then Switch Over
- Keep the current working scheduler in place while configuring its replacement. Avoid overlapping live executions during the controlled verification.
- Inspect the HTTP result and JSON: the route returns
Status: Success and a Jobs collection after it runs. Inspect job results and the relevant due order/message history as well; a top-level success is not proof that every email or payment succeeded. - Confirm a scheduled run succeeds without a logged-in browser session. Check the next scheduled invocation too.
- Only after the external scheduler is verified, set this plugin’s WP Cron Job to Disable if it would otherwise duplicate the work. Do not disable WordPress cron site-wide just to configure this plugin.
- Monitor failures, overdue jobs, and processing duration. If the replacement fails, restore the previously working schedule while correcting authentication or connectivity.
Cron Troubleshooting
- 403: recopy the generated URL or verify the configured header key; a bare route is insufficient.
- Success but no expected work: review due dates, plan status, collection method, saved-card eligibility, reminder limits, and the Jobs details.
- Late reminders: check the scheduler’s actual run history, server time, timezone, queue limits, and mail delivery.
- Repeated attempts: check for overlapping schedulers and review retry/spacing settings before running again.