Fix PayPal donation crediting and redirect, add REST/Webhooks support - #85
Merged
Merged
Conversation
Fixes HerculesWS#41 (donations not crediting) and HerculesWS#58 (wrong post-donation redirect), plus adds an opt-in PayPal REST API + Webhooks flow alongside classic IPN.
MrKeiKun
force-pushed
the
paypal-rest-ipn-fix
branch
from
September 25, 2026 13:44
f120e7c to
89e8317
Compare
Streusel
reviewed
Sep 25, 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.
The classic IPN handler verified PayPal notifications with a raw
fsockopen/hand-built HTTP request, and required the sender's reverse-DNS hostname to matchipn.sandbox.paypal.com/notify.paypal.com. PayPal doesn't guarantee reverse-DNS records for its IPN-sending IPs, so this check silently rejected genuine, verified transactions and left accounts uncredited. Replacedverify()with a cURL request and dropped the hostname check, relying solely on the notify-validate handshake as PayPal's docs describe.Also fixes the post-donation redirect:
button.phppointed PayPal'sreturnURL at the main page instead ofdonate/complete, and the dead code inpreprocess.phpthat was supposed to catch it relied on amerchant_return_linkparameter PayPal never actually sends.Adds an opt-in PayPal REST API + Webhooks donation flow (
PayPalMode = 'rest') alongside the existing classic IPN, for admins who want to move off the legacy integration. Both paths were tested end-to-end against PayPal's sandbox, including duplicate delivery, held/untrusted accounts, and PHP 8.3 deprecation warnings, turning up and fixing a handful of smaller pre-existing bugs along the way (a schema column too narrow for real PayPal IDs, a directory permission bug that broke transaction file logging, and a couple of null-handling issues).Fixes #41, #58