I am using CakePHP 1.3.10 version and want to integrate PayPal IPN for Payment Process.
I have found some ready made plug-ins though not working properly and returning bunch of errors.
I would like your suggestions, Any body in community using the same with success and any tutorial to integrate in easy steps.
Your response would be appreciated.
Thanks !
I used Paypal IPN with cake before, and it's simple enough to not have to reply on a plugin. Are you using that to track getting payment in a cake app? You can create the paypal form/button in your paypal account, set the url callback so paypal can notify you. Create a table in DB if you want to record the info paypal sends you. Have a method in the controller to handle the POST data from paypal. Here's my code example:
function blah() { $this->autoRender = false; // post back to PayPal system to validate $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } $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"; $fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30); if (!$fp) {// HTTP ERROR, we should record the data still..? } else { fputs($fp, $header . $req); while (!feof($fp)) { $res = fgets($fp, 1024); if (strcmp($res, "VERIFIED") == 0) {// verified from paypal, processing... } else if (strcmp($res, "INVALID") == 0) { // oh no, someone is hijacking us... } } fclose($fp); } }
What fields to have in the table depends on what you want to keep. Look up the IPN API, and you can setup sandbox testing with paypal.