anstrangel0ver
anstrangel0ver

Reputation: 1073

Recurring Payments paypal inserting data in database

I have successful integrate CreateRecurringPaymentsProfile method that will recurre payment from the client. Now what I need to do is:

After every month of reccuring payment I need to insert data in my database table. Is there anything that I get response from paypal after the payment is done? Or how can I insert data in my database after each time period?

Thank you all for reading my post. I looking forward for your post - any suggestion are most welcome.

Regards, anstrangelover

Upvotes: 0

Views: 589

Answers (2)

icchanobot
icchanobot

Reputation: 3343

I use this library: http://codeigniter.com/wiki/PayPal_Lib/

It works pretty well for me. I created an order_model which maps to a table match the fields I want from the IPN, then I just made a controller with a method like this:

function ipn(){
    $this->load->library("paypal_lib");
    $res = $this->paypal_lib->ipn();

    $response = print_r($res, TRUE);
    log_message('error', $response);

    if(isset($res["error"])) {
        log_message('error', 'fail');
        return;
    }
    if($res["verified"]) {
        log_message('error', 'verified');
        $res["payment"] = "paypal";
        $new_order = $this->order_model->create($res["data"]);  
        log_message('error', 'created order: '.$new_order['id']);           
    } else {
        log_message('error', 'no error, but not verified?');
    }
}

Upvotes: 0

MikeCruz13
MikeCruz13

Reputation: 1254

You need to look into the APIs and such that paypal offers:

https://www.x.com/developers/paypal/products/instant-payment-notification

https://www.paypal.com/ipn

IPN can send notifications for these transactions:

Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds

Upvotes: 1

Related Questions