Part of the EllisLab Network
   
 
PayPal IPN Library - How to post IPN results to db in model?
Posted: 02 November 2007 01:07 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  70
Joined  09-26-2007

Got the Paypal IPN Library working great! But…I can’t add payment and cart info to my db tables in the model. I can email the results though. Here’s what I have:

Controller

function ipn()
    
{        
        
if ($this->paypal_lib->validate_ipn()) 
        
{
            
if ($this->paypal_lib->ipn_data['txn_type'== "cart")
            
{
                $this
->load->model('Store_model'''TRUE);
                
$this->Store_model->paypalIPNInsertCartPaymentInfo();
                
$this->Store_model->paypalIPNInsertCartItemInfo();
            
}
        }
    } 

Model

function paypalIPNInsertCartPaymentInfo()
    
{
        $datecreation 
date("Y").date("m").date("d");
        
        
$updatedata = array(
            
'paymentstatus' => $this->paypal_lib->ipn_data['payment_status'],
            
'buyer_email' => $this->paypal_lib->ipn_data['payer_email'],
            ...
            );
        
        
$this->db->insert('paypal_payment_info'$updatedata);
    
Profile
 
 
Posted: 20 February 2011 08:35 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  4
Joined  02-20-2011

To post IPN results to db in model, I would suggest using my new library:

PayPal IPN library for CodeIgniter

It has saving to db baked in - no extra code required.

Profile
 
 
Posted: 23 June 2011 02:23 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  10-28-2009

you use doctrine which opens up a whole other can of worms that many CI users are not using.

Profile