Is hier iemand die wat ervaring heeft met paypal IPN?
Ik heb ergens dit scriptje gevonden:
Maar hoe kan ik nu precies te werk gaan om dit te testen of dit werkt?PHP Code:
<?php
// 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";
//If testing on Sandbox use:
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
//$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 ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
// echo the response
echo "The response from IPN was: <b>" .$res ."</b><br><br>";
//loop through the $_POST array and print all vars to the screen.
foreach($_POST as $key => $value){
echo $key." = ". $value."<br>";
}
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
// echo the response
echo "The response from IPN was: <b>" .$res ."</b>";
}
}
fclose ($fp);
}
?>
Via de paypal developer site kan je wel zo'n IPN test doen, maar dit lijkt niet direct te lukken bij mij. Kan iemand me misschien eens vertellen wat ik verkeerd gedaan heb, of wat er tekort is? Of op welke manier ik precies te werk moet gaan, want met de uitleg vanop de paypal website ben ik niet echt verder gekomen. Ik ben op dit vlak helaas geen zo'n expert.
- vraagje betreffende paypal IPN
-
20-08-2010, 07:28 #1
- Berichten
- 106
- Lid sinds
- 16 Jaar
vraagje betreffende paypal IPN
-
-
21-08-2010, 22:13 #2
- Berichten
- 7
- Lid sinds
- 16 Jaar
Is hier iemand die wat ervaring heeft met paypal IPN?
Ik heb ergens dit scriptje gevonden:
PHP Code:<?php
// 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";
//If testing on Sandbox use:
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
//$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 ($res, "VERIFIED") == 0) {
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
// echo the response
echo "The response from IPN was: <b>" .$res ."</b><br><br>";
//loop through the $_POST array and print all vars to the screen.
foreach($_POST as $key => $value){
echo $key." = ". $value."<br>";
}
}
else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigation
// echo the response
echo "The response from IPN was: <b>" .$res ."</b>";
}
}
fclose ($fp);
}
?>
Via de paypal developer site kan je wel zo'n IPN test doen, maar dit lijkt niet direct te lukken bij mij. Kan iemand me misschien eens vertellen wat ik verkeerd gedaan heb, of wat er tekort is? Of op welke manier ik precies te werk moet gaan, want met de uitleg vanop de paypal website ben ik niet echt verder gekomen. Ik ben op dit vlak helaas geen zo'n expert.
Welke error krijg jij wanneer je het probeert via sandbox,
Het script kan niet worden uitgevoerd via paypal als je het via "localhost" doet.
voor de rest weet ik het ook niet, ik weet namelijk de error niet dus kan het alleen gokken. en ik neem aan als het op paypal website stond dan moet het werken dus ik denk dat het aan jou ligt.
Hier is de basis hoe ongeveer het script werkt:
Code:// 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"; }
Code:$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";
Code:$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
Code:fputs ($fp, $header . $req); while (!feof($fp)) { $res = fgets ($fp, 1024);
Code:if (strcmp ($res, "VERIFIED") == 0) { // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment // echo the response echo "The response from IPN was: <b>" .$res ."</b><br><br>"; //loop through the $_POST array and print all vars to the screen. foreach($_POST as $key => $value){ echo $key." = ". $value."<br>"; } }
Code:else if (strcmp ($res, "INVALID") == 0) { // log for manual investigation // echo the response echo "The response from IPN was: <b>" .$res ."</b>"; }
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic