Skip to main content

PayPal Community

  • Dashboard
  • Send and Request
  • Wallet
  • Business
  • Help
Log in

Le Forum de la communauté n’est pas disponible pour les nouveaux messages ou les réponses; les articles précédents restent disponibles pour vérification. Afin de connaître les options d’assistance complètes, rendez-vous sur PayPal.com/HelpCenter

Si vous souhaitez signaler du contenu illégal et contraire au Règlement sur les services numériques de l’Union Européenne (DSA), veuillez cliquer ici.

since ‎Sep-27-2021
Country: United Kingdom
Type: Business
MikeHt
MikeHt
New Community Member
1
Post
0
Kudos
0
Solutions
Active
View all
Latest Contributions by MikeHt
  • Topics MikeHt has Participated In
  • Latest Contributions by MikeHt

IPN listener stopped working

by MikeHt in PayPal Reporting
‎Sep-27-2021 02:16 PM
‎Sep-27-2021 02:16 PM
Hi Several years ago I created an IPN listener (using PHP) based on a code sample that was provided by PayPal's Integration Guide(s). It worked beautifully for years - and then stopped! PayPal support say that the IPN is working and that my listener is correctly verifying the responses etc but it won't do what it used to do. I have a feeling that PayPal have changed things and left my code behind.  I have looked on github but the example code they are giving does not make sense to me.   Please can someone help. I have copied my listener code below. Can someone please just tell me what is wrong and what I need to do.  This is driving me up the wall!   Thank you very much...   <!DOCTYPE html> <html lang="en"> <head> <title>Untitled Document</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> </head> <body> <? // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ( $_POST as $key => $value ) { $value = urlencode( stripslashes( $value ) ); $req .= "&$key=$value"; } // 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: www.paypal.com\r\n"; $header .= "Connection: close\r\n\r\n"; $fp = fsockopen( 'ssl://www.paypal.com', 443, $errno, $errstr, 30 ); if ( !$fp ) { // HTTP ERROR } else { fputs( $fp, $header . $req ); while ( !feof( $fp ) ) { $res = fgets( $fp, 1024 ); if ( strcmp( trim( $res ), "VERIFIED" ) == 0 ) { // assign posted variables to local variables $item_name = $_POST[ 'item_name' ]; $item_number = $_POST[ 'item_number' ]; $payment_status = $_POST[ 'payment_status' ]; $payment_amount = $_POST[ 'mc_gross' ]; $payment_currency = $_POST[ 'mc_currency' ]; $txn_id = $_POST[ 'txn_id' ]; $receiver_email = $_POST[ 'receiver_email' ]; $payer_email = $_POST[ 'payer_email' ]; $first_name = $_POST[ 'first_name' ]; if ( $payment_status == "Completed" ) { // I have some PHP code here (irrelevant to the operation of this listener) } } else if ( strcmp( trim( $res ), "INVALID" ) == 0 ) { // log for manual investigation // the code here is never activated either! } } fclose( $fp ); } ?> </body> </html>   ... View more
Labels:
  • Labels:
  • IPN
Paypal Logo
  • Help
  • Contact Us
  • Security
  • Fees
  • © 1999-2025 PayPal, Inc. All rights reserved.
  • Privacy
  • Legal
  • Cookies
  • Policy Updates

The money in your balance is eligible for pass-through FDIC insurance.

The PayPal Cash Mastercard is issued by The Bancorp Bank pursuant to a license by Mastercard International Incorporated. The Bancorp Bank; Member FDIC.

Powered by Khoros