Bonjour,

j'ai tester mon COMPTE sandbox et j'ai un email ipn invalid voici le code log

IPN Result: POST_VARS: array (
'payment_type' => 'echeck',
'payment_date' => 'Wed Oct 25 2017 00:10:04 GMT+0200',
'payment_status' => 'Completed',
'address_status' => 'confirmed',
'payer_status' => 'verified',
'first_name' => 'John',
'last_name' => 'Smith',
'payer_email' => 'buyer@paypalsandbox.com',
'payer_id' => 'TESTBUYERID01',
'address_name' => 'John Smith',
'address_country' => 'United States',
'address_country_code' => 'US',
'address_zip' => '95131',
'address_state' => 'CA',
'address_city' => 'San Jose',
'address_street' => '123 any street',
'business' => 'seller@paypalsandbox.com',
'receiver_email' => 'seller@paypalsandbox.com',
'receiver_id' => 'seller@paypalsandbox.com',
'residence_country' => 'US',
'item_name' => 'something',
'item_number' => 'AK-1234',
'quantity' => '1',
'shipping' => '3.04',
'tax' => '2.02',
'mc_currency' => 'USD',
'mc_fee' => '0.44',
'mc_gross' => '12.34',
'mc_gross_1' => '12.34',
'txn_type' => 'web_accept',
'txn_id' => '463820243',
'notify_version' => '2.1',
'custom' => 'xyz123',
'invoice' => 'abc1234',
'test_ipn' => '1',
'verify_sign' => 'A6paVutjtNZJ4oOan3cpTdXeJadIAdWu1uZcJgdLfXWt-iM68RJDNaWE',
)
j'ai mis ipn simulator en statut complet.

voici ma page ipn :

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
session_start();
include_once("../config.php");
include_once("paypal.class.php");
 
 // lire le formulaire provenant du système PayPal et ajouter 'cmd'
$req = 'cmd=_notify-validate';
 
foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req .= '&$key=$value';
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www'.$PayPalMode.'.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HEADER, 0);
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_HTTPHEADER, array('Host: www'.$PayPalMode.'.sandbox.paypal.com'));
$res = curl_exec($ch);
curl_close($ch);
 
if (strcmp ($res, 'VERIFIED') == 0)
{
$post_vars = var_export($_POST, true);
error_log("IPN Result: " . $res, 3, "ipn.log");
error_log("POST_VARS: " . $post_vars, 3, "ipn.log");
 
$transaction_id = $_POST['txn_id'];
$payerid = $_POST['payer_id'];
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$payeremail = $_POST['payer_email'];
$address1 = $_POST['address1'];
$ville = $_POST['city'];
$cp = $_POST['zip'];
$state = $_POST['state'];
$tel = $_POST['night_phone_a'];
$paymentdate = $_POST['payment_date'];
$paymentstatus = $_POST['payment_status'];
$mdate= date('Y-m-d h:i:s',strtotime($paymentdate));
$otherstuff = json_encode($_POST);
 
$conn = mysql_connect($db_host,$db_username,$db_password);
if (!$conn)
{
die('Could not connect: ' . mysql_error());
}
 
mysql_select_db($db_name, $conn);
 
// insert in our IPN record table
$query = 'INSERT INTO ibn_table
(itransaction_id,ipayerid,iname,iemail,iadresse1,icp,iville,itel,itransaction_date, ipaymentstatus,ieverything_else)
VALUES('.$transaction_id.','.$payerid.','.$firstname.' '.$lastname.','.$payeremail.','.$adress1.','.$cp.','.$iville.','.$tel.','.$mdate.', '.$paymentstatus.','.$otherstuff.')';
 
 
// PHPmailer ------------------------------------------------------------------------------------
 
require 'PHPMailer/PHPMailerAutoload.php';
//$iemail = $_POST['payer_email'];
$iemail = 'gaborit.elodie@gmail.com';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('gaborit.elodie@gmail.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('gaborit.elodie@gmail.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress($iemail);
//Set the subject line
 
    /* Ajout des variables au mail */
$mail->Subject = 'Confirmation de commande chez GDINOX!';
$mail->Body     = "Bonjour &nbsp;&nbsp;$lastname $firstname";
    //$body = file_get_contents('mail-confirmation-commande.html');
   // $body = preg_replace("~{firstname}~i", $firstname, $body);
    //$body = preg_replace("~{lastname}~i", $lastname, $body);
 
    $mail->MsgHTML($body);
//Attach an image file
//$mail->addAttachment('images/portfolio/service.jpg');
 
//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
}
else{
$post_vars = var_export($_POST, true);
error_log("IPN Result: " . $res, 3, "ipn.log");
error_log("POST_VARS: " . $post_vars, 3, "ipn.log");	
    /*
    An Invalid IPN *may* be caused by a fraudulent transaction attempt. It's
    a good idea to have a developer or sys admin manually investigate any 
    invalid IPN.
    */
    mail('gaborit.elodie@gmail.com', 'Invalid IPN', $req);
}
?>


Merci.