2013-07-18 8 views
6

मैंने सैंडबॉक्स मोड को आजमाने के लिए डेवलपर में टेस्ट अकाउंट्स बिजनेस और पर्सनल सेट अप किया है।पेपैल आईपीएन सैंडबॉक्स - आईपीएन श्रोता - कोई सत्यापित या अमान्य

मैंने अपनी साइट पर भुगतान बटन बनाया है। मैं बटन क्लिक करता हूं और पेपैल पर जाता हूं। परीक्षण उपयोगकर्ता व्यक्तिगत खाते का भुगतान करने के लिए उपयोग किया जाता है। भुगतान जब मैं पेपैल व्यवसाय खाते में देखता हूं तो पूरा हो जाता है और पूरा हो जाता है। मेरी साइट पर रीडायरेक्ट अच्छा काम करता है।

तो मेरी आंखों में मुझे "काम करने" प्रणाली होनी चाहिए।

मेरा आईपीएन श्रोता हालांकि सत्यापित या अमान्य नहीं लौटाता है।

<?php 
require("../widgets/init.inc.php"); 

//Test the script is launced 
$log_query = mysql_query("INSERT INTO `log` VALUES (' ','zz','ff','rr', 'rr')");     

// Link to PayPal Codes // 
// https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables // 

// 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.0\r\n"; 
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 

//For the below line i have tried "www.sandbox.paypal" as well as "www.paypal" 
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); 

// 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']; 
$txnId = $_POST['txn_id']; 
$receiverEmail = $_POST['receiver_email']; 
$payerEmail = $_POST['payer_email']; 
//$id = ($_POST['custom']); 

if (!$fp) { 

} else { 
fputs ($fp, $header . $req); 
while (!feof($fp)) { 
$res = fgets ($fp, 1024); 
if (strcmp ($res, "VERIFIED") == 0) { 

if ($payment_status=='Completed') { 

//$txnIdCheck = mysql_query("SELECT `txnId` FROM `log` WHERE `txnId`='".$txnId."'"); 
//if (mysql_num_rows($txnIdCheck) !=1) { 

// enter your email address associated with your paypal account here // 
if ($receiverEmail=='[email protected]') { 

/* when a new premium member makes payment paypal will update our database. The txn_id from paypal, members email address, date of payment and members id we gave them when they joined our site will be inserted into the log table. At the same time the memberAdmin table for the member will be updated by adding a '1' to premium and the date of payment so the new premium member will have access to premium areas of your site. */ 

//Check if verified is launced   
$log_query_2 = mysql_query("INSERT INTO `log` VALUES (' ','yes','yes','yes', 'yes')");   

//$log_query = mysql_query("INSERT INTO `log` VALUES (' ','".intval($id)."','".$txnId."','".$payerEmail."', now())");     

//$update_premium = mysql_query("UPDATE `memberAdmin` SET `premium`=1, `premiumDate`=now() WHERE `id`=".intval($id)."");  

}  
//} 
} 
} 
else if (strcmp ($res, "INVALID") == 0) {   
//Check if invalid is launced 
$log_query_2 = mysql_query("INSERT INTO `log` VALUES (' ','no','no','no', 'no'"); 
} 
} 
fclose ($fp); 
} 
?> 

मैं पेपैल व्यापार खाते स्थल पर IPN सक्रिय कर लिया है:

यह मेरा श्रोता है। मैं paypal से लौटे जानकारी का एक txt फ़ाइल बना दिया है, और यह इस तरह दिखता है:

==== Thu, 18 Jul 2013 01:34:21 +0200 ==== 
POST: mc_gross = 0.01 
POST: protection_eligibility = Ineligible 
POST: payer_id = 73WPPK8HKSW7C 
POST: tax = 0.00 
POST: payment_date = 15:15:20 Jul 17, 2013 PDT 
POST: payment_status = Completed 
POST: charset = windows-1252 
POST: first_name = Niels 
POST: mc_fee = 0.01 
POST: notify_version = 3.7 
POST: payer_status = verified 
POST: business = [email protected] 
POST: quantity = 1 
POST: verify_sign = A-ddKAwtxju4TpHGJOGq6c3ewj26AyiHsD.XO90coZ.4rVzOT7VyooKO 
POST: payer_email = [email protected] 
POST: txn_id = 6WH41489RE087103M 
POST: payment_type = instant 
POST: last_name = Tester 
POST: receiver_email = [email protected] 
POST: payment_fee = 0.01 
POST: receiver_id = PCX638B2M7WPA 
POST: txn_type = web_accept 
POST: item_name = 500Credits 
POST: mc_currency = USD 
POST: item_number = 1 
POST: residence_country = DE 
POST: test_ipn = 1 
POST: handling_amount = 0.00 
POST: transaction_subject = 500Credits 
POST: payment_gross = 0.01 
POST: shipping = 0.00 
POST: ipn_track_id = 2dffcbf8767d3 
InvoiceID: 
Custom1: 
Custom2: 
Custom3: 

ऐसा लगता है जैसे कि यह एक बहुत कठिन इस मैं क्या लगता है कि यह होना चाहिए की तुलना में काम करने के लिए प्राप्त करने के लिए है।

उत्तर

13

मुझे समस्या मिली .. और नाराज बात यह है कि पेपैल दस्तावेज फिर से गलत है .. मुझे समझ में नहीं आता है कि दस्तावेज़ीकरण इस बटन को दबा सकता है और इस बटन को दबा सकता है .. जब इस तरह के कोई बटन नहीं हैं साइट ...

इस समस्या के लिए - दस्तावेज एक गलत विधि बताता है/इसमें पूर्ण कोड आवश्यक नहीं है।

समस्या:

HTTP/1.0 400 Bad Request 
Server: BigIP 
Connection: close 
Content-Length: 19 
Invalid Host header 

क्या जोड़ा जाना चाहिए:

$header .= "Host: www.sandbox.paypal.com\r\n"; 

और फिर ऊपर कोड इस तरह दिखता है:

// post back to PayPal system to validate // 
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; 
$header .= "Host: www.sandbox.paypal.com\r\n"; 
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 
$ रेस इस लौटे

यह पूरा कोड था जिसका उपयोग मैंने समाप्त किया:

<?php 
require("../widgets/init.inc.php");   

// Link to PayPal Codes // 
// https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables // 

// 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.0\r\n"; 
$header .= "Host: www.sandbox.paypal.com\r\n"; 
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30); 

// 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']; 
$txnId = $_POST['txn_id']; 
$receiverEmail = $_POST['receiver_email']; 
$payerEmail = $_POST['payer_email']; 
//$id = ($_POST['custom']); 


if (!$fp) { 

} else { 
fputs ($fp, $header . $req); 
while (!feof($fp)) { 
$res = fgets ($fp, 1024); 

$log_query_pre = mysql_query("INSERT INTO `log` VALUES (' ','$receiverEmail','$payment_status','$res', 'yes')");  

    if (strcmp ($res, "VERIFIED") == 0) { 

if ($payment_status=='Completed') { 

//$txnIdCheck = mysql_query("SELECT `txnId` FROM `log` WHERE `txnId`='".$txnId."'"); 
//if (mysql_num_rows($txnIdCheck) !=1) { 

// enter your email address associated with your paypal account here // 
if ($receiverEmail=='[email protected]') { 

/* when a new premium member makes payment paypal will update our database. The txn_id from paypal, members email address, date of payment and members id we gave them when they joined our site will be inserted into the log table. At the same time the memberAdmin table for the member will be updated by adding a '1' to premium and the date of payment so the new premium member will have access to premium areas of your site. */ 

//Check if verified is launced   
$log_query_2 = mysql_query("INSERT INTO `log` VALUES (' ','yes','yes','yes', 'yes')");  

//$log_query = mysql_query("INSERT INTO `log` VALUES (' ','".intval($id)."','".$txnId."','".$payerEmail."', now())");     

//$update_premium = mysql_query("UPDATE `memberAdmin` SET `premium`=1, `premiumDate`=now() WHERE `id`=".intval($id)."");  

}  
//} 
} 
} 
else if (strcmp ($res, "INVALID") == 0) {   
//Check if invalid is launced 
$log_query_2 = mysql_query("INSERT INTO `log` VALUES (' ','no','no','no', 'no')"); 
} 
} 
fclose ($fp); 
} 
?> 
+1

धन्यवाद! मुझे दोपहर एक ही परेशानी हो रही है। खुशी है मैंने यह पाया। निराशाजनक है कि यह एक दस्तावेज़ीकरण त्रुटि है ... –

+1

धन्यवाद! मुझे एक ही समस्या है। – oliverbj

+0

@Niels मैं ऊपर दिए गए चरणों का पालन करता हूं लेकिन $ res HTTP/1.1 200 ठीक कर रहा है ठीक है, मैं सत्यापित या INVALID संदेश कैसे प्राप्त कर सकता हूं? – oletob

संबंधित मुद्दे