I'm building a multi-page signup form, using the Wizard component, which seems 
to be pretty cool:

https://github.com/jaredhoyt/cakephp-wizard

After entering their preferred username, password, blood type, and mother's 
maiden shoe size, I'm going to be directing users over to PayPal to pay for 
these services they're signing up with me for. When the PayPal transaction is 
complete, PayPal will redirect the user back to a "done" page on my site. Or, 
if the transaction is cancelled in PayPal land, I believe PayPal will redirect 
the user to a "cancel" page on my site. On these pages I can then tell the user 
useful things, like "Thanks for giving me money" or "You didn't give me any 
money".

Ultimately, I will want to use the data the customer has provided to create 
several database records: users, services, etc. I'm trying to determine what I 
should be doing with the user's data between the time they've entered it and 
the time they've succeeded in paying me.

I could keep the data in the session only, until the "done" page is reached, at 
which point I actually save() it into the appropriate models. This is how the 
provided Wizard example handles it. One worry I have here is: what if the user 
picked a username, and I validated on page 1 of the wizard that it was unique, 
but by the time they came back from PayPal, someone else created that username. 
So the user paid me, but the save() into the database with all the data about 
what they paid me for fails. Maybe this is a rare enough occasion that I can 
get away with just logging all the data and manually fixing this later.

I could create the e.g. User and Service records as soon as I have enough data 
from the customer. What if the user cancels the PayPal transaction? In the 
"cancel" page, I could delete the records again. What if the user just closes 
the window when they see the PayPal screen? My "cancel" page will never be 
reached and I'll have stale records lingering in the database. What if the user 
later comes back and tries again? Now the username they wanted to pick is 
already sitting around unused in my database and they can't have it anymore.

To avoid stale or unfinished records in important tables like users and 
services, I could have an entirely new table, orders, and fill it with 
information about the order. After coming back from PayPal successfully, I 
could mark the order as ready to be filled. Then I'd need to transfer the data 
from the orders table into corresponding users and services records.

Does anyone here have experience doing this kind of signup form and could share 
some recommendations? I'd love to hear what you did and whether it worked well.






-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to