0

Ich benutze adaptive Zahlungen auf Paypal.Adaptive Payments IPN nicht senden

Ich habe das Feld ipnNotificationUrl auf meine JSON-Daten hinzugefügt, aber diese URL wird nie aufgerufen. Meine Zahlung wird jedoch ausgeführt und ich werde zur Erfolgsseite weitergeleitet.

In meiner IPN-Geschichte sind alle meine Zahlungen durch "Nouvel essai en cours" ("Neue laufende Studie") markiert.

"actionType" => "PAY", 
"currencyCode" => "EUR", 
"receiverList" => array(
    "receiver" => array(
     array(
      "amount" => "5.00", 
      "email"  => "[email protected]" 
     ), 
     array(
      "amount" => "2.00", 
      "email"  => "[email protected]" 
     ) 
    ) 
), 
"returnUrl" => "http://myUrl.com/return.php", 
"cancelUrl" => "http://myUrl.com/cancel.php", 
"ipnNotificationUrl" => "http://myUrl.com/ipn.php", 
"requestEnvelope" => array(
    "errorLanguage" => "en_US", 
    "detailLevel" => "ReturnAll" 
) 

In meinem ion.php Skript schreibe ich eine Datei, um zu sehen, wenn sie aufgerufen wird. Aber diese Datei wird nie geschrieben.

file_put_contents("called", "file is called"); 

define("DEBUG", 1); 
define("USE_SANDBOX", 1); 
define("LOG_FILE", "./ipn.log"); 

$raw_post_data = file_get_contents('php://input'); 
$raw_post_array = explode('&', $raw_post_data); 
$myPost = array(); 
foreach ($raw_post_array as $keyval) { 
    $keyval = explode ('=', $keyval); 
    if (count($keyval) == 2) 
     $myPost[$keyval[0]] = urldecode($keyval[1]); 
} 
// read the post from PayPal system and add 'cmd' 
$req = 'cmd=_notify-validate'; 
if(function_exists('get_magic_quotes_gpc')) { 
    $get_magic_quotes_exists = true; 
} 
foreach ($myPost as $key => $value) { 
    if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) { 
     $value = urlencode(stripslashes($value)); 
    } else { 
     $value = urlencode($value); 
    } 
    $req .= "&$key=$value"; 
} 
// Post IPN data back to PayPal to validate the IPN data is genuine 
// Without this step anyone can fake IPN data 
if(USE_SANDBOX == true) { 
    $paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; 
} else { 
    $paypal_url = "https://www.paypal.com/cgi-bin/webscr"; 
} 
$ch = curl_init($paypal_url); 
if ($ch == FALSE) { 
    return FALSE; 
} 
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $req); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); 
if(DEBUG == true) { 
    curl_setopt($ch, CURLOPT_HEADER, 1); 
    curl_setopt($ch, CURLINFO_HEADER_OUT, 1); 
} 
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); 

$res = curl_exec($ch); 
if (curl_errno($ch) != 0) // cURL error 
    { 
    if(DEBUG == true) { 
     error_log(date('[Y-m-d H:i e] '). "Can't connect to PayPal to validate IPN message: " . curl_error($ch) . PHP_EOL, 3, LOG_FILE); 
    } 
    curl_close($ch); 
    exit; 
} else { 
     // Log the entire HTTP response if debug is switched on. 
     if(DEBUG == true) { 
      error_log(date('[Y-m-d H:i e] '). "HTTP request of validation request:". curl_getinfo($ch, CURLINFO_HEADER_OUT) ." for IPN payload: $req" . PHP_EOL, 3, LOG_FILE); 
      error_log(date('[Y-m-d H:i e] '). "HTTP response of validation request: $res" . PHP_EOL, 3, LOG_FILE); 
     } 
     curl_close($ch); 
} 
$tokens = explode("\r\n\r\n", trim($res)); 
$res = trim(end($tokens)); 
if (strcmp ($res, "VERIFIED") == 0) { 
    error_log(date('[Y-m-d H:i e] '). "Verified IPN: $req ". PHP_EOL, 3, LOG_FILE); 
} else if (strcmp ($res, "INVALID") == 0) { 
    error_log(date('[Y-m-d H:i e] '). "Invalid IPN: $req" . PHP_EOL, 3, LOG_FILE); 

} 

Danke für Ihre Hilfe.

Antwort

-1

Ich löste mein Problem. Die IPN-Links sollten keine IP-Adresse sein (http://x.x.x.x/).

1

Zuerst, Sie müssen Ihr IPN-Skript im ipn-Simulator überprüfen. - Melden Sie sich an https://developer.paypal.com/ - Gehen Sie zu https://developer.paypal.com/developer/ipnSimulator/ - Überprüfen Sie Ihr IPN-Skript.

für z.B. : IPN-Handler URL: http://www.domainname.com/ipn.php Transaktionstyp: Wählen Sie Ihren Transaktionstyp

Diese URL wird verwendet, um Ihr IPN-Skript zu überprüfen, richtig läuft oder nicht.

Zweite,

Sie benötigen eine IPN-Skript in Ihrem PayPal-Konto eingerichtet werden soll. Lass mich deine Schritte geben.

  • Login Ihr PayPal-Konto
  • Klicken Sie auf Profil-Link
  • Klicken Sie auf den Link 'Meine Verkaufs Tools'
  • Klicken Sie auf 'Aktualisieren' Verknüpfung von 'Instant-Zahlungsbenachrichtigungen'.
  • Klicken Sie auf die Schaltfläche 'IPN-Einstellungen wählen'
  • Geben Sie Ihren IPN-Skriptpfad ein. für z.B. http://www.domainname.com/ipn.php
  • Wählen Sie "IPN-Nachrichten empfangen (aktiviert)"
  • Klicken Sie auf die Schaltfläche Speichern.

Jetzt wird auf diese Weise Ihr ipn Skript in Paypal gespeichert. Fügen Sie außerdem "notifyurl" in Ihrem PayPal-Code hinzu.

Versuchen Sie diese Schritte. Sie können Ihr Problem lösen.

+0

Ich habe einen Fehler im Simulator (IPN wurde nicht gesendet, und der Handshake wurde nicht überprüft. Bitte überprüfen Sie Ihre Informationen.). Ich habe mein IPN-Skript bereits in meinem PayPal-Konto eingerichtet. –

+0

kannst du mir bitte deine Fehlermeldung zukommen lassen – Hardik