Hello,

I'm using Webtechnicks Paypal Plugin. It works great. After someone
pays and if the transaction was completed in my application I update
the user and mark them as a subscribing customer.

However they have to logout then log back in before it actually takes
effect for them. If, after they make a payment and they come back to
my site they are still logged in and the application acts as if they
haven't paid. But once they log out then log back in it all shows up
that they are paid.

Is there a way to get around this?

Nothing else in my application has this problem as when they upload an
avatar or whatever other changes they make to their account the
effects in the database are immediate to the application. Maybe its my
code. Here's the code I use to update the user after a completed
payment.

AppController:

function afterPaypalNotification($txnId){
        // Get the transaction
        $transaction =
ClassRegistry::init('PaypalIpn.InstantPaymentNotification')-
>findById($txnId);
        $this->log($transaction['InstantPaymentNotification']['id'],
'paypal');

        // check that it was complete
        if($transaction['InstantPaymentNotification']['payment_status'] ==
'Completed'){
             // grab the custom variable(its the users id) that was returned
from paypal and upgrade that user to subscribed
             $user = ClassRegistry::init('User')-
>findById($transaction['InstantPaymentNotification']['custom']);
             ClassRegistry::init('User')->id = $user['User']['id'];
             ClassRegistry::init('User')->saveField('subscribed',
'yes');
         }
}

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to