paypal / ipn-code-samples

Other
562 stars 485 forks source link

IPN POST causing 403 errors using Perl listener #34

Closed rjpryor closed 8 years ago

rjpryor commented 9 years ago

I use a Perl listener to get IPN POST messages from PayPal. Starting sometime after May 19, these messages starting getting a server error 403. Here is the Perl code I'm using to process what is sent to me. Any ideas on how to fix it. I'm not a Perl programmer so please show line changes.

!/usr/bin/perl

# read post from PayPal system and add 'cmd'
read (STDIN, $query, $ENV{'CONTENT_LENGTH'});
$query .= '&cmd=_notify-validate';

# post back to PayPal system to validate
use LWP::UserAgent;
$ua = new LWP::UserAgent;
#  $req = new HTTP::Request 'POST','https://www.sandbox.paypal.com/cgi-bin/webscr';
$req = new HTTP::Request 'POST','https://www.paypal.com/cgi-bin/webscr';
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);
$res = $ua->request($req);

Thanks, Rich

rjpryor commented 9 years ago

I'm new here and I have no idea why some of the code is bold and in larger font.

overint commented 8 years ago

You need to mark the section as code so it isn't parsed as markdown. @rjpryor, can I close this issue?

rjpryor commented 8 years ago

Would you please send me the latest PERL example. I'm still getting an error here:

process what was passed back from PayPal

if ($res->is_error) {

HTTP error

$transaction_status='ERROR1'; print W "PayPal Completion Code = $transaction_statusn"; }

It seems like paypal sends the message again and it sometimes goes through okay, but not always.

Rich

505-977-6339

On Oct 3 2016 7:21 PM, Evan McMahon wrote:

You need to mark the section as code so it isn't parsed as markdown. @rjpryor [1], can I close this issue?

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [2], or mute the thread [3].

Rich Pryor 505-275-7780 (home) 505-977-6339 (cell)

Links:

[1] https://github.com/rjpryor [2] https://github.com/paypal/ipn-code-samples/issues/34#issuecomment-251272011 [3] https://github.com/notifications/unsubscribe-auth/AMHGiDiHWGmX1koUHFdR6A0kgoZ6rKakks5qwan8gaJpZM4EzFdR

overint commented 8 years ago

I'm not a perl dev so unfortunately i'm not sure what the problem is, and do not have the setup to debug it. Maybe try this example? https://github.com/sflex/ipn-code-samples/blob/b08b64e6fd1a97f9aa03cd94b619e01af9913f57/paypal_ipn.pl

rjpryor commented 8 years ago

I'm not a perl expert but this code is different from what I am using. I'll give it a try.

Thanks,

Rich

On Oct 4 2016 7:10 PM, Evan McMahon wrote:

I'm not a perl dev so unfortunately i'm not sure what the problem is, and do not have the setup to debug it. Maybe try this example?

https://github.com/sflex/ipn-code-samples/blob/b08b64e6fd1a97f9aa03cd94b619e01af9913f57/paypal_ipn.pl [1]

You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub [2], or mute the thread [3].

Rich Pryor 505-275-7780 (home) 505-977-6339 (cell)

Links:

[1] https://github.com/sflex/ipn-code-samples/blob/b08b64e6fd1a97f9aa03cd94b619e01af9913f57/paypal_ipn.pl [2] https://github.com/paypal/ipn-code-samples/issues/34#issuecomment-251557307 [3] https://github.com/notifications/unsubscribe-auth/AMHGiAtEGwxeTs_3b5gYqGf0Dc_epkFjks5qwvjugaJpZM4EzFdR

overint commented 8 years ago

No worries, let me know how you go.

overint commented 8 years ago

Did you manage to get it working @rjpryor?

rjpryor commented 8 years ago

Evan,

I haven't changed over to the code you gave because Verio, my ISP, is making some major changes that may affect the way I receive IPN messages. I thought I would just wait and see what happens. Meanwhile, my existing code works about 75 percent of the time. When it fails, I input the subscription data manually.

Regards,

Rich

On Oct 27 2016 8:20 PM, Evan McMahon wrote:

Did you manage to get it working @rjpryor [1]?

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [2], or mute the thread [3].

Rich Pryor 505-275-7780 (home) 505-977-6339 (cell)

Links:

[1] https://github.com/rjpryor [2] https://github.com/paypal/ipn-code-samples/issues/34#issuecomment-256820263 [3] https://github.com/notifications/unsubscribe-auth/AMHGiPHj54Tcr82L87Fz2F-PMaj4D7uHks5q4VvbgaJpZM4EzFdR

overint commented 8 years ago

No worries. There's a new perl sample (strict version) which you could try as well. I'll close this now.