Welcome Guest, Not a member yet? Register   Sign In
PayPal IPN Library - How to post IPN results to db in model?
#1

[eluser]spheroid[/eluser]
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
Code:
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
Code:
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);
    }
#2

[eluser]alexatkeplar[/eluser]
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.
#3

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




Theme © iAndrew 2016 - Forum software by © MyBB