Open LonjaZurbaran opened 11 months ago
I have the exact same issue. Dev needs to be more responsive here.
I did notice the IPN URL returns a notice error: /plugins/prepaid_credits/paypal_ipn.php
Notice: Undefined index: custom in /home/www/plugins/prepaid_credits/include/functions.inc.php on line 102
Now that's just a notice and won't stop functioning, but still.
I used PayPal's IPN simulator and it said it worked fine, soooo
https://cdn.microtronix-tech.com/imgs/firefox_1jZ6DJPqPd.png
Thanks a lot jfreak53. I'm stuck with this yet.
Very frustrating.
Any idea how to solve it?
.
.,
No, not yet, haven't had time to dig into it. Its honestly ticking me off since the plugin doesn't truly work, it won't let me also manually add credits to a user. So its basically not working at all.
So turns out the problem is the IPN verification process. The old code had it posting back to the Paypal IPN to verify the transaction but to HTTP, no SSL! So of course, Paypal just gave it an error back. Line 123:
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
So that just fails completely! I tried making it SSL and a whole bunch of other things, but to no avail. I got it to finally work against Paypal using this code:
$header ="POST /cgi-bin/webscr?cmd=_notify-validate HTTP/1.1\r\n";
$header .="Content-Type: text/html; charset=utf-8\r\n";
$header .="Host: www.paypal.com\r\n";
$header .="Content-Length: " . strlen($req) . "\r\n";
$header .="Connection: close\r\n\r\n";
$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
But now Paypal just tells me invalid transaction. I don't have the time right now to finish debugging to make it work. Needless to say the code needs a lot of work.
What I did for the mean time until I can fix it is just remove all the verifying stuff so it just works. So comment from 109 to 157 of the code, then make the verify variable as true:
$is_payment_verified = true;
After that it just works fine. Eventually, if the dev never gets back to us here I'll dig more and make the verify work, but for right now it works and adds credits just fine. Finally!
Sorry, meant to say, its this file includes/functions.inc.php
Here is an evolution of the IPN check I implemented in another project (and this code works for sure)
// post back to PayPal system to validate
$header ="POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .="Content-Type: application/x-www-form-urlencoded\r\n";
$header .="Host: ipnpb.paypal.com:443\r\n";
$header .="Content-Length: " . strlen($req) . "\r\n";
$header .="Connection: close\r\n\r\n";
$fp = fsockopen ('ssl://ipnpb.paypal.com', 443, $errno, $errstr, 30);
Can someone check before I work on updating the plugin?
I tried that exact code, it doesn't work. That code gets it to the point where it actually gets an invalid response from PayPal, instead of a 400 error, so its the correct implementation. But, PayPal keeps giving back an invalid response. I'm pretty sure its because of the payload being sent to the verify URL, I think something is wrong with the payload it doesn't like.
Just don't have the time right today to dig into the variables more.
I expected Piwigo version 14 (recently released) could fix the problem, but not at all.
Credits keep being payable (I receive the money ok at my Paypal account), but nothing is received after payment :-( The buyer doesn't get anything in return.
Very frustrating.
open the ../plugins/prepaid_credits/include/functions.inc.php
go to line 487 $filename = preg_replace_callback('#\$escape((.?))#', create_function('$m', 'return str2url($m[1]);'), $filename); $filename = preg_replace_callback('#\$upper((.?))#', create_function('$m', 'return str2upper($m[1]);'), $filename); $filename = preg_replace_callback('#\$lower((.?))#', create_function('$m', 'return str2lower($m[1]);'), $filename); $filename = preg_replace_callback('#\$strpad((.?),(.?),(.?))#', create_function('$m', 'return str_pad($m[1],$m[2],$m[3],STR_PAD_LEFT);'), $filename);
replace width: $filename = preg_replace('#\$escape((.?))#', str2url($filename[1]), $filename); $filename = preg_replace('#\$upper((.?))#', str2upper($filename[1]), $filename); $filename = preg_replace('#\$lower((.?))#', str2lower($filename[1]), $filename); $filename = preg_replace('#\$strpad((.?),(.?),(.?))#', str_pad($filename,3,STR_PAD_LEFT), $filename);
it's work
So turns out the problem is the IPN verification process. The old code had it posting back to the Paypal IPN to verify the transaction but to HTTP, no SSL! So of course, Paypal just gave it an error back. Line 123:
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
So that just fails completely! I tried making it SSL and a whole bunch of other things, but to no avail. I got it to finally work against Paypal using this code:
$header ="POST /cgi-bin/webscr?cmd=_notify-validate HTTP/1.1\r\n"; $header .="Content-Type: text/html; charset=utf-8\r\n"; $header .="Host: www.paypal.com\r\n"; $header .="Content-Length: " . strlen($req) . "\r\n"; $header .="Connection: close\r\n\r\n"; $fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
But now Paypal just tells me invalid transaction. I don't have the time right now to finish debugging to make it work. Needless to say the code needs a lot of work.
What I did for the mean time until I can fix it is just remove all the verifying stuff so it just works. So comment from 109 to 157 of the code, then make the verify variable as true:
$is_payment_verified = true;
After that it just works fine. Eventually, if the dev never gets back to us here I'll dig more and make the verify work, but for right now it works and adds credits just fine. Finally!
This makes the payments write to MySQL, so to fix this just make it add up the credit purchases from the specified user minus what they spent in MySQL. This whole thing should work again if you do that.
Hi, community. I'm running a Piwigo (13.8 version / Modus theme) with some galleries and 'Prepaid Credits' plug-in.
Plug-in correctly configured. It's really clear and easy.
Now, when a user pays for credits, the money arrives ok to Admin paypal account. Instantaneously. That's great.
But the user never get the credits (the message: "...No worry! Buy more credits on your profile page..." appears again and again) and his wallet keeps at 'zero'.
At first sight, there's no error message at all. No special message displays.
The customer clicks on 'buy credits', which redirects to Paypal, then they make the payment without any problem and automatically that money comes to my Paypal account.
So that seems to work flawlessly. But, when the user comes back to the gallery, there's no such credits in her account. Just 'Zero' credits.
I get my money but he doesn't get his credits.
Can anybody figure out what am I doing wrong?
Environment
Activated plugin list 1