problemmam taki. Za kazdym razem gdy place (sandboxowe konta) , strona paypala wyswietla ze platnosc zostala dokonana i przekierowuje mnie do mojego example.php ktory jednoczesnie jest IPNem. Mimo uz w paypalu wsio gra skrypt ipn mowi mi ze transakcja jest nie VERIFIED

oto class z kroter kozystam
<?php // Original Author: Pineapple Technologies // License: Free (GPL) // // Modified By: ScriptDevelopers.NET (http://www.scriptdevelopers.net) // Modified Date: September 14, 2003 // // Modified to use cURL as PayPal now does a redirect no matter // whether you use http or https, or get or post. Using cURL, you // can have php properly follow the redirect and have the expected // VERIFIED or INVALID responses. // class paypal_ipn { var $paypal_post_vars; var $paypal_response; var $protocol; var $url_string; var $timeout; // error logging info var $error_log_file; var $error_email; function paypal_ipn($paypal_post_vars, $protocol = "s") { $this->paypal_post_vars = $paypal_post_vars; $this->protocol = $protocol; $this->timeout = 120; $this->url_string = "http" . $this->protocol . "://www.paypal.com/cgi-bin/webscr?"; } // sends response back to paypal function send_response() { // put all POST variables received from Paypal back into a URL encoded string foreach($this->paypal_post_vars AS $key => $value) { // if magic quotes gpc is on, php added slashes to the values so we need // to strip them before we send the data back to Paypal. { } // make an array of URL encoded values } // join the values together into one url encoded string // add paypal cmd variable $this->url_string .= "&cmd=_notify-validate"; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $this->url_string); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; www.ScriptDevelopers.NET; PayPal IPN Class)"); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_TIMEOUT, $this->timeout); $this->paypal_response = curl_exec ($ch); curl_close($ch); } // end function send_response() // returns true if paypal says the order is good, false if not function is_verified() { { return true; } else { return false; } } // end function is_verified // returns the paypal payment status function get_payment_status() { return $this->paypal_post_vars['payment_status']; } // writes error to logfile, exits script function error_out($message) { // add on the data we sent: $message .= "nnThe following input was received from (and sent back to) PayPal:nn"; { $message .= $key . ':' . " t$valuen"; } $message .= "nn" . $this->url_string . "nn" . $this->paypal_response; // log to file? if( $this->error_log_file ) { $message = "$datenn" . $message . "nn"; } // email errors? if( $this->error_email ) { $additional_headers = "From: "$fromname" <$from>nReply-To: $from"; } exit; } // end function error_out } // end class paypal_ipn ?>
A tutaj moj skrypt ipn korzystajacy z classy ^
example.php
<?php //////////////////////////////////////////////////////////////////////////////// // example.php // php paypal_ipn class example //////////////////////////////////////////////////////////////////////////////// require("paypal_ipn.php"); // PayPal will send the information through a POST $paypal_info = $HTTP_POST_VARS; // To disable https posting to PayPal uncomment the following // $paypal_ipn = new paypal_ipn($paypal_info, ""); // Then comment out this one $paypal_ipn = new paypal_ipn($paypal_info); // where to contact us if something goes wrong $paypal_ipn->error_email = "thornag@hychsohn.org"; // We send an identical response back to PayPal for verification $paypal_ipn->send_response(); // PayPal will tell us whether or not this order is valid. // This will prevent people from simply running your order script // manually if( !$paypal_ipn->is_verified() ) { // bad order, someone must have tried to run this script manually } // payment status switch( $paypal_ipn->get_payment_status() ) { case 'Completed': break; case 'Pending': break; case 'Failed': break; case 'Denied': break; default: // order is no good break; } // end switch ?>
Czy ktos kiedykolwiek bawil sie paypalem ? Mial podobne problemy ?