Repository navigation
fix: stop a failed usage-tracker call from fataling the thank-you page (2.0.9) - #24
Merged
Merged
Conversation
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
requested review from
Andrew-Paystack and
benjamin-ts-paystack
October 28, 2026 07:49
benjamin-ts-paystack
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After a successful payment (test and live), customers get a PHP fatal instead of the confirmation page:
maybe_thankyou_page()callslog_transaction_success(), a usage-tracking POST toplugin-tracker.paystackintegrations.com. That host currently returns HTTP 530 / Cloudflareerror code: 1016as 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\Throwableand writes the failure toerror_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 aTypeError.GF_PAYSTACK_VERSION,Stable tag, changelog and upgrade notice.Testing
WP_Error, and a JSON scalar body. They fail on 2.0.8 and pass with this change. Full suite: 131 passed, 0 failed.php -lon PHP 7.2 is clean, andgit archiveships only the plugin files.Follow-ups (not in this PR)
plugin-tracker.paystackintegrations.com. Fixing it there helps every installed version immediately.plugin-memberpress,plugin-paid-membership-pro,plugin-sprout-invoicesandplugin-wpjobstercall the same tracker. Check that they handle the failure.