paypal ipn working but stopping at 'thank you' page.

Posted by Tarique Imam on Stack Overflow See other posts from Stack Overflow or by Tarique Imam
Published on 2010-04-01T16:31:20Z Indexed on 2010/04/01 16:33 UTC
Read the original article Hit count: 361

Filed under:
|
|
|

I am using the code for controller(CODEIGNITER):

function paypal_tran(){

if (empty($_GET['action'])){ $_GET['action'] = 'process';} if($this->uri->segment ( 3 )){ $action=$this->uri->segment ( 3 ); } else{ $action='process'; }

                          $ammount=39.99;

$this->lenders_model->paypal_process($action,$this_script,$ammount); $this->load->view('view_paypal_tran');

                }

                function ipn(){


                       if ($this->paypal_class->validate_ipn()) {



 $data = array(



  'fname'=> 'fname', /* insert the user id */

           'lname'=>'lname'


  );



 //$this->db->insert('ajax_test',$data);

     // For this example, we'll just email ourselves ALL the data.
     $subject = 'Instant Payment Notification - Recieved Payment';
     $to = '[email protected]';    //  your email
     $body =  "An instant payment notification was successfully recieved\n";
     $body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
     $body .= " at ".date('g:i A')."\n\nDetails:\n";

     foreach ($this->paypal_class->ipn_data as $key => $value) { $body .= "\n$key: $value"; }
     mail($to, $subject, $body);
  }









                }


                function success()
                {

                         $this->load->view('paypal_succ_view');


                }

AND this is my model:

 function paypal_process($action,$this_script,$ammount){

switch ($action) {

case 'process': // Process and order...

  // There should be no output at this point.  To process the POST data,
  // the submit_paypal_post() function will output all the HTML tags which
  // contains a FORM which is submited instantaneously using the BODY onload
  // attribute.  In other words, don't echo or printf anything when you're
  // going to be calling the submit_paypal_post() function.

  // This is where you would have your form validation  and all that jazz.
  // You would take your POST vars and load them into the class like below,
  // only using the POST values instead of constant string expressions.

  // For example, after ensureing all the POST variables from your custom
  // order form are valid, you might have:
  //
  // $p->add_field('first_name', $_POST['first_name']);
  // $p->add_field('last_name', $_POST['last_name']);

  $this->paypal_class->add_field('business', '[email protected]');
  $this->paypal_class->add_field('return', $this_script.'/success');
  $this->paypal_class->add_field('cancel_return', $this_script.'/cancel');
  $this->paypal_class->add_field('notify_url', $this_script.'/ipn');
  $this->paypal_class->add_field('item_name', 'Lenders Account for one month');
  $this->paypal_class->add_field('amount', $ammount);

  $this->paypal_class->submit_paypal_post(); // submit the fields to paypal
  $this->paypal_class->dump_fields();      // for debugging, output a table of all the fields
  break;

PROBLEM IS IPN IS NOT WORKING. THE HIDDEN FIELD HAS VALUE FOR REDIRECT TO IPN, BUT NOT WORKING!!PLS HELP

© Stack Overflow or respective owner

Related posts about paypal

Related posts about ipn