• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

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 Moore
Donovan Moore
  • 3
  • 2
1 Solution
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 MooreAuthor 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,
Donovan MooreAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now