There are several reports of this error in these forums, but none of the solutions are valid for me.
The problem: When new subscribers complete payment at PayPal they are redirected back to our site, but get this error:
ERROR: Unable to verify $_SERVER[“HTTP_HOST”].
Please contact Support for assistance.
If you are the site owner, please check the custom value in your Button Code. It MUST start with your domain name.
The subscription button code was copied from s2Member/PayPal Buttons/Resulting PayPal Code and integrated into an HTML form. The custom value mentioned in the error message is supplied:
<input type="hidden" name="custom" value="[our_site].com" />
In the gateway-core-rtn.log, incomplete information is logged with the original error. I’ve edited some info in square brackets:
LOG ENTRY: Wed Nov 14th, 2018 @ precisely 9:27 pm UTC
PHP v7.0.30 :: WordPress v4.9.8 :: s2Member v170722 :: s2Member Pro v170722
Memory 4.73 MB :: Real Memory 6.00 MB :: Peak Memory 4.85 MB :: Real Peak Memory 6.00 MB
[our_site].com/?s2member_paypal_return=1&amt=0.01&cc=USD&cm=[our_site].com&item_number=1&sig=[signature]&st=Completed&tx=[tx code]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
Array
(
[transaction_subject] => [subject name]
[payment_date] => 13:27:30 Nov 14, 2018 PST
[txn_type] => subscr_payment
[last_name] => [last name]
[residence_country] => US
[payment_gross] => 0.01
[mc_currency] => USD
[business] => [our PayPal email]
[payment_type] => instant
[protection_eligibility] => Ineligible
[payer_status] => verified
[payer_email] => [my email]
[txn_id] => [17-digit ID]
[receiver_email] => [our PayPal email]
[first_name] => Len
[payer_id] => [13-digit ID]
[receiver_id] => [13-digit ID]
[contact_phone] => [my phone]
[payment_status] => Completed
[payment_fee] => 0.01
[mc_fee] => 0.01
[mc_gross] => 0.01
[charset] => windows-1252
[s2member_log] => Array
(
[0] => Return-Data received on: Wed Nov 14, 2018 9:27:42 pm UTC
[1] => s2Member POST vars verified through a POST back to PayPal.
[2] => Unable to verify `$_SERVER["HTTP_HOST"]`. Please check the `custom` value in your Button Code. It MUST start with your domain name.
[3] => Redirecting Customer to the Home Page (after displaying an error message).
)
[subscr_gateway] => paypal
)
However, while I am viewing the original error page I can reload the page (no changes) and the error will go away and the normal ‘Thank you! You’ve been updated to:’ page appears.
Back to the gateway-core-rtn.log after reload, it now has a complete entry:
LOG ENTRY: Thu Nov 15th, 2018 @ precisely 3:34 pm UTC
PHP v7.0.30 :: WordPress v4.9.8 :: s2Member v170722 :: s2Member Pro v170722
Memory 4.81 MB :: Real Memory 2.00 MB :: Peak Memory 4.88 MB :: Real Peak Memory 2.00 MB
[our_site].com/?s2member_paypal_return=1&amt=0.01&cc=USD&cm=[our_site].com&item_number=1&sig=[sig code]&st=Completed&tx=[tx code]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0
Array
(
[mc_gross] => 0.01
[invoice] => [invoice number]~[my IP]
[protection_eligibility] => Ineligible
[payer_id] => [payer id]
[payment_date] => 13:27:30 Nov 14, 2018 PST
[payment_status] => Completed
[charset] => windows-1252
[first_name] => Len
[option_selection1] => 31
[option_selection2] => [my IP]
[mc_fee] => 0.01
[subscr_id] => [subscr ID]
[custom] => [our site].com
[payer_status] => verified
[business] => [our PayPal email]
[payer_email] => [my email]
[option_name1] => Referencing Customer ID
[option_name2] => Customer IP Address
[contact_phone] => [my phone]
[txn_id] => [tx ID]
[payment_type] => instant
[last_name] => [last name]
[receiver_email] => [our PayPal email]
[payment_fee] => 0.01
[receiver_id] => [recvr ID]
[txn_type] => subscr_payment
[item_name] => One Pet Protected
[mc_currency] => USD
[item_number] => 1
[residence_country] => US
[transaction_subject] => [subject]
[payment_gross] => 0.01
[option_selection] => 31
[option_name] => Referencing Customer ID
[s2member_log] => Array
(
[0] => Return-Data received on: Thu Nov 15, 2018 3:34:28 pm UTC
[1] => s2Member POST vars verified through a POST back to PayPal.
[2] => s2Member originating domain ( `$_SERVER["HTTP_HOST"]` ) validated.
[3] => s2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ).
[4] => s2Member `txn_type` identified as ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.
[5] => s2Member Level/Capabilities updated w/ advanced update routines.
[6] => Transient Tracking Cookie set on ( `web_accept|subscr_signup|subscr_payment` ) w/ update vars.
[7] => Redirecting Customer to the Login Page (after displaying a quick thank-you message). They need to log back in.
)
[subscr_gateway] => paypal
[subscr_baid] => [subscr ID]
[subscr_cid] => [subscr ID]
[level] => 1
[ccaps] =>
[eotper] =>
[ip] => [my IP]
)
Related notes:
– I’ve echoed the $_SERVER[‘HTTP_HOST’] value upon return to our site, it is valid (contains our domain name in the format ‘example.com’)
– All returns from PayPal fail with same error, it is not intermittent.
– Reloading the error page ALMOST always changes to success, but the error has been repeated if I try to reload too quickly after getting the original error.
– As shown by the dates in the log, I can paste the same URL that previously produced the error the next day and I get the success page on first try.
– The gateway-core-ipn.log file has this success line, even when the gateway-core-rtn.log has the ‘Unable to verify…’ error:
[2] => s2Member originating domain (
$_SERVER[“HTTP_HOST”]) validated.
Any help will be appreciated.