PayPal: Add to Cart Form Submissions

First of all, I am a complete newbie when it comes to PHP.  And, I have taken this question to the PayPal Developer's Forum, but haven't gotten anywhere.

I have a site that will be selling reporting services - the user will select a specific report or reports, fill in all of the pertinent 'selection criteria' (or filters) per report, and then purchase.

Here's what I am trying to do:

 1. Have the user fill out various information on a form, and press 'Add to Cart'.
 2. Hold that information and not submit the info until the user checks out and purchases the item.
 3. Delete the form info if the user removes the item from the cart.

My main problem has to do with how I can have the user fill in the information on my form(s), submit the data (Add to Cart) and have the ability to remove the item (and potentially add new items) without sending me an email.  I only want to send the data when they have checked out.  And, I would rather not have the user fill out personal info (name, company, etc.) until they get to the checkout process.

I have also purchased a third-party IPN script to handle the post-process, but am pretty clueless as to get all of this to work.

Any and all help would be greatly appreciated!
Donovan MooreConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Before you get in trouble on this, please consider hiring a developer.  You have a HUGE number of legal issues that you must deal with when selling online.  It is not a safe place to cut your teeth on PHP.  I will try to answer some of the conceptual things a little later today, but please play it safe when there is e-commerce and money involved.

Best regards, ~Ray
Donovan MooreConsultantAuthor Commented:
Thanks for the advice.  I would still be interested in your conceptual thoughts on this, but I think we might make this a more manual process at this time (having users fill out the forms, and then we would invoice them manually).

Thanks for your honesty.
Ray PaseurCommented:
You're welcome and I think that would be a wise way to start.  Here is what I would do, conceptually speaking.

As the clients enter data into forms, put the data into the data base in a table called (for example) "purchases".  You identify the data with a "purchase request id" - you can carry this field in the session variable.  When all the selection criteria have been entered and you know what kind of report you plan to sell, you create a "buy-now" button and attach the "purchase request id" to one of the fields in the buy-now button form - probably product number.  Then you present the dynamically created "buy-now" button to the client.  This could also be an "add-to-cart" button if you're using the PayPal shopping cart - there is not much difference in the way the IPN would work.

In the IPN script, you will see the purchase price, as well as the other variables that describe the client and the transaction.  Validate this information, then mark the purchase request in the data base as having been paid.  You can use the IPN script to start an automated fulfillment process.  In one of my applications it initiates a product shipment, producing the shipping labels, etc., for a remote warehouse.

It's important to carry the purchase request id field(s) into the IPN because even though the IPN runs on your server, it is not within the scope of your web site, so it does not have access to the session data.  But it will have access to your data base, and with the purchase request id, you should be able to track and process the request correctly.

Some of your clients will start requests and not complete the purchase, and that will leave junk records in the data base.  You can write a garbage collection routine to tidy this up after, for example, a month of inactivity.

You may want to look into 3rd-party shopping carts.  I think Magento and OS-Commerce are well thought of, but I have not used them in my work.

Best of luck with it,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Donovan MooreConsultantAuthor Commented:
We're going to go the more manual route at this time, but your advice was great.  Thanks for taking the time to share.
Ray PaseurCommented:
Thanks for the points - it's a great question, ~Ray
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.