Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Sir Osis of Liver on January 17, 2019, 05:39:02 PM

Title: Dump PayPal verification?
Post by: Sir Osis of Liver on January 17, 2019, 05:39:02 PM
Chasing what appears to be a server related Paid Subs glitch, would like to view the PayPal verification postback.  Looks like it happens here -



// Get the data back...
while (!feof($fp))
{
$this->return_data = fgets($fp, 1024);
if (strcmp(trim($this->return_data), 'VERIFIED') == 0)
break;
}



Subscription fails here -



/// If this isn't verified then give up...
if (strcmp(trim($this->return_data), 'VERIFIED') != 0) {
log_error('Paid Subscriptions error - IPN verification failed');
exit;
}



If I comment it out, sub activates.  PP support says verification is posted to forum.  Would like to at least confirm receipt, and view post data if possible.


Just checked, curl 7.29.0 is enabled, but verification still fails if I comment out curl code.

Title: Re: Dump PayPal verification?
Post by: live627 on January 19, 2019, 04:40:17 PM
Maybe you could try

log_error(var_export($this->return_data,  true)); ???

I think that logs the data to the error log.
Title: Re: Dump PayPal verification?
Post by: Sir Osis of Liver on January 19, 2019, 10:45:43 PM
I'll give it a try soon as I get a chance.  Thanks.

Title: Re: Dump PayPal verification?
Post by: Sir Osis of Liver on January 24, 2019, 05:39:40 PM
Running this code -



/// If this isn't verified then give up...

if (strcmp(trim($this->return_data), 'VERIFIED') == 0)
log_error('Paid Subscription successful');
log_error(var_export($this->return_data, true));

if (strcmp(trim($this->return_data), 'VERIFIED') != 0) {
log_error('Paid Subscriptions error - IPN verification failed');
log_error(var_export($this->return_data, true));
exit;
}




On test forum where sub activates normally, logs two errors -



http://www.thekrashsite.com/smf20/subscriptions.php
'VERIFIED'

http://www.thekrashsite.com/smf20/subscriptions.php
Paid Subscription successful



On client forum where verification fails, logs three errors -



https://www.nukeworker.com/forum/subscriptions.php
false

https://www.nukeworker.com/forum/subscriptions.php
Paid Subscriptions error - IPN verification failed

https://www.nukeworker.com/forum/subscriptions.php
false



Verification postback is sent from same PayPal ip as IPN, and we are receiving IPN, but either not receiving VERIFIED or it is somehow damaged.  Still stumped. >:(
Title: Re: Dump PayPal verification?
Post by: Arantor on January 24, 2019, 06:11:31 PM
Find out if the hosting company restricts outward net connections, e.g. what the value of allow_url_fopen is.
Title: Re: Dump PayPal verification?
Post by: Sir Osis of Liver on January 24, 2019, 06:13:58 PM
If that were the case, wouldn't PayPal not be receiving postback from forum?  They've told me postback is received, and they are sending verification.

phpinfo reports allow_url_fopen is 'On' (Local & Master).
Title: Re: Dump PayPal verification?
Post by: live627 on January 24, 2019, 07:38:26 PM
There are two code paths there: curl and fsock. Did you determine which one it uses?  Have you tried commenting out the curl code block?
Title: Re: Dump PayPal verification?
Post by: Sir Osis of Liver on January 24, 2019, 10:41:57 PM
Yes, commented out curl code to force http, same result.  Other odd thing is, with verification commented out, subs activate ok, but around 10-15% are reported as active and pending.  There are also random currency errors that don't correspond with anything else.