Skip to content

fix: stop a failed usage-tracker call from fataling the thank-you page (2.0.9) - #24

Merged
jules-paystack merged 2 commits into
mainfrom
release/v2.0.9
Oct 28, 2026
Merged

jules-paystack merged 2 commits into
mainfrom
release/v2.0.9

Conversation

@jules-paystack

Copy link
Copy Markdown
Contributor

Problem

After a successful payment (test and live), customers get a PHP fatal instead of the confirmation page:

Uncaught Exception: There was an issue connecting with the payment processor. Try again later.
in class-gf-paystack-api.php:92
#0 class-gf-paystack-api.php(42): GFPaystackApi->send_request('log/charge_succ...', ...)
#1 class-gf-paystack.php: GFPaystackApi->log_transaction_success(...)

maybe_thankyou_page() calls log_transaction_success(), a usage-tracking POST to plugin-tracker.paystackintegrations.com. That host currently returns HTTP 530 / Cloudflare error code: 1016 as plain text. send_request() throws on a non-JSON body, and nothing catches the exception. The charge itself succeeds; only the confirmation page breaks. This affects 2.0.8 and every earlier version.

Fix

  • log_transaction_success() catches \Throwable and writes the failure to error_log. Tracking can no longer block the confirmation page.
  • send_request() treats any decoded body that isn't an array (for example a JSON string such as "error") as unreadable and throws its usual exception. Previously that case caused a TypeError.
  • Release 2.0.9: version header, GF_PAYSTACK_VERSION, Stable tag, changelog and upgrade notice.

Testing

  • New regression tests for a non-JSON tracker body, a transport WP_Error, and a JSON scalar body. They fail on 2.0.8 and pass with this change. Full suite: 131 passed, 0 failed.
  • Runtime, in a WordPress 7.1.3 / PHP 8.2 container calling the live tracker host:
    • 2.0.8 reproduces the reported uncaught fatal.
    • This branch logs the failure and returns normally.
  • php -l on PHP 7.2 is clean, and git archive ships only the plugin files.

Follow-ups (not in this PR)

  • Restore or retire plugin-tracker.paystackintegrations.com. Fixing it there helps every installed version immediately.
  • The tracker call still blocks for up to 15s if the host is slow rather than down. Consider making it non-blocking in 2.1.0.
  • plugin-memberpress, plugin-paid-membership-pro, plugin-sprout-invoices and plugin-wpjobster call the same tracker. Check that they handle the failure.

The plugin tracker host returns a non-JSON Cloudflare error, so send_request()
threw and the uncaught exception replaced the confirmation page after every
successful payment. Tracker failures are now logged and ignored, and
send_request() treats any non-array JSON body as an unreadable response.
@jules-paystack
jules-paystack merged commit faf1c06 into main Oct 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants