Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello all. I have what I hope is a simple solution to my issue, I just need a little couch help.

My site is a pay-to-play.
You register, then you pay thru paypal and you come back.
Due to the process, and the absolute importance of them returning, I have my own paypal code I use that automatically redirects them once the payment is complete.

My problem: I have nothing to tie their returning with the same that was forwarded to paypal to create automatic account activation once the payment has been authenticated.

My solution: If I can get, as part of the registration process, the activation code put into the session variables, then as they return, I can create a link that grabs the activation code out of the session that would automatically activate their account.

What I need help with: I need to find out how to put the activation code into the $_SESSION upon registration.

Can anyone help with this?

Thanks for anything anyone can do.
Hi scratz,

Can you please let us know in detail how you have incorporated PayPal code in Couch's registration workflow? I gather that you are using your own custom code for that.

Problem with standard PayPal processing is that we cannot rely on the user coming back to our site once the payment is successful (you can find more about this at http://www.couchcms.com/docs/concepts/paypal.html).

This is precisely why the asynchronous IPN is used by PayPal to send payment intimations.

If you are using PayPal Standard, the solution would be to send the user's account ID as a field named 'custom' e.g.
<input type="hidden" name="custom" value="380">

When PayPal sends back the IPN it'll contain the custom value we send above.
This can be used by our IPN handler to find the right user account and activate it.

You can use the code on Couch's cms:paypal_button to write your IPN handler.

Hope this helps.
Hello and thank you for your response. I will be glad to explain further my use of paypal. KK, if you have my ftp creds from before, that is still active and I can give you admin couch rights to study it further.

As far as the Couch paypal button, once the user goes to paypal and pays, they have to click a link to return to the site.

The paypal button code provided by the client's paypal account does an automatic return to the site once the payment is confirmed. I can program it to go to any page I create through paypal's 'sellers tools' called 'website preferences'.
I've tested this function by putting some information in SESSION at the time of registration, and indeed once a payment is confirmed it takes the user to a page I've created and the SESSION information is retained.
With the couch registration system, the activation code is placed in an email, but that won't work for my application. A person can only activate their account once they've paid.

What I did was create a payment page where, upon registration, the user gets redirected to the payment page that has the code. The page has security on it (or will) that states it can only be gotten to via the registration link. This payment page has the paypal code on it that takes the user to the sellers info, supplied already by the 'sellers tools' code.

KK, in your replay you say, "If you are using PayPal Standard, the solution would be to send the user's account ID as a field named 'custom' e.g.
<input type="hidden" name="custom" value="380">
"
I may be confused by this but this would go on the "product.php" template? But the user would still maybe drop out once the payment is confirmed and not return. This would lead to big headaches. Is there a way to program the procedure for the automatic return upon payment confirmation?

I did set up a sandbox paypal and test that out, using the Couch paypal button and information. If it returned automatically, that would be great, but it hasn't in any situation I've tried.

I'm happy to explain more if needed. I have a tendency to get wordy :) I hope this helps realize what I'm trying to achieve.
There are other ways to go about it, but the activation code, being a random number put in the session just seems the most secure for the automatic activation. Of course, I'm open to any suggestions.
I think I just realized something I may have been missing this whole time.
Are you saying that, as long as I have the correct information put into the template that creates the paypal button, once the user pays, there can be an activation script happen whether or not they decide to return to the site?

If that's the case, then I'm really sorry I missed that.

but if that is the case, I'm still not sure how I tie the user account that registered to the paypal button. Yes, a user page was created, but how do I get that user's email into the paypal IP? Suppose their login to paypal is a different email than they used to register?
Please ignore this entire thread as it's confusing and I think goes beyond what couch is supposed to be used for :oops: KK you can delete this thread if you want.
Sorry, I'll be more targeted in future posts.
5 posts Page 1 of 1